Package dev.morphia

Class InsertManyOptions

  • All Implemented Interfaces:
    dev.morphia.internal.CollectionConfigurable<InsertManyOptions>, dev.morphia.internal.CollectionConfiguration, dev.morphia.internal.WriteConfigurable<InsertManyOptions>

    public class InsertManyOptions
    extends Object
    implements dev.morphia.internal.WriteConfigurable<InsertManyOptions>, dev.morphia.internal.CollectionConfigurable<InsertManyOptions>
    Options related to insertion of documents into MongoDB. The setter methods return this so that a chaining style can be used.
    Since:
    1.3
    • Constructor Detail

      • InsertManyOptions

        public InsertManyOptions()
        Creates a new options wrapper
      • InsertManyOptions

        @MorphiaInternal
        public InsertManyOptions​(InsertManyOptions that)
        Parameters:
        that - the options to copy
        Since:
        2.0
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Method Detail

      • bypassDocumentValidation

        public InsertManyOptions bypassDocumentValidation​(Boolean bypassDocumentValidation)
        Sets whether to bypass document validation.
        Parameters:
        bypassDocumentValidation - whether to bypass document validation, or null if unspecified
        Returns:
        this
        Since server release
        3.2
      • collection

        public InsertManyOptions collection​(@Nullable
                                            String collection)
        Description copied from interface: dev.morphia.internal.CollectionConfigurable
        Sets the alternate collection to use for the operation.
        Specified by:
        collection in interface dev.morphia.internal.CollectionConfigurable<InsertManyOptions>
        Parameters:
        collection - the name of the collection to use
        Returns:
        this
      • collection

        @Nullable
        public String collection()
        Description copied from interface: dev.morphia.internal.CollectionConfigurable
        Returns the alternate collection to use for the operation. Might return null.
        Specified by:
        collection in interface dev.morphia.internal.CollectionConfigurable<InsertManyOptions>
        Returns:
        the collection name or null
      • bypassDocumentValidation

        @Nullable
        public Boolean bypassDocumentValidation()
        Gets whether to bypass document validation, or null if unspecified. The default is null.
        Returns:
        whether to bypass document validation, or null if unspecified.
        Since server release
        3.2
      • getBypassDocumentValidation

        @Nullable
        @Deprecated(forRemoval=true,
                    since="2.3")
        public Boolean getBypassDocumentValidation()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Gets whether to bypass document validation, or null if unspecified. The default is null.
        Returns:
        whether to bypass document validation, or null if unspecified.
        Since server release
        3.2
      • writeConcern

        public InsertManyOptions writeConcern​(@Nullable
                                              WriteConcern writeConcern)
        Description copied from interface: dev.morphia.internal.WriteConfigurable
        Set the write concern to use.
        Specified by:
        writeConcern in interface dev.morphia.internal.WriteConfigurable<InsertManyOptions>
        Parameters:
        writeConcern - the write concern
        Returns:
        this
      • writeConcern

        @Nullable
        public WriteConcern writeConcern()
        Description copied from interface: dev.morphia.internal.WriteConfigurable
        The write concern to use. By default the write concern configured for the MongoCollection instance will be used.
        Specified by:
        writeConcern in interface dev.morphia.internal.WriteConfigurable<InsertManyOptions>
        Returns:
        the write concern, or null if the default will be used.
      • getOptions

        @Deprecated(forRemoval=true,
                    since="2.3")
        public InsertManyOptions getOptions()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the driver version of this instance
      • isOrdered

        @Deprecated(forRemoval=true,
                    since="2.3")
        public boolean isOrdered()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Gets whether the documents should be inserted in the order provided, stopping on the first failed insertion. The default is true. If false, the server will attempt to insert all the documents regardless of an failures.
        Returns:
        whether the the documents should be inserted in order
      • options

        @MorphiaInternal
        public InsertManyOptions options()
        Returns:
        the driver version of this instance
        Since:
        2.3
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • ordered

        public InsertManyOptions ordered​(boolean ordered)
        Sets whether the server should insert the documents in the order provided.
        Parameters:
        ordered - true if documents should be inserted in order
        Returns:
        this