Package dev.morphia
Class InsertOneOptions
- java.lang.Object
-
- dev.morphia.InsertOneOptions
-
- All Implemented Interfaces:
dev.morphia.internal.CollectionConfigurable<InsertOneOptions>,dev.morphia.internal.CollectionConfiguration,dev.morphia.internal.WriteConfigurable<InsertOneOptions>
public class InsertOneOptions extends Object implements dev.morphia.internal.WriteConfigurable<InsertOneOptions>, dev.morphia.internal.CollectionConfigurable<InsertOneOptions>
Options related to insertion of documents into MongoDB. The setter methods returnthisso that a chaining style can be used.- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor Description InsertOneOptions()Creates a new options wrapperInsertOneOptions(InsertOneOptions that)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BooleanbypassDocumentValidation()InsertOneOptionsbypassDocumentValidation(Boolean bypassDocumentValidation)Sets whether to bypass document validation.Stringcollection()Returns the alternate collection to use for the operation.InsertOneOptionscollection(String collection)Specifies an alternate collection to use rather than the mapped collection.InsertOneOptionscomment(String comment)InsertOneOptionscomment(BsonValue comment)BooleangetBypassDocumentValidation()Deprecated, for removal: This API element is subject to removal in a future version.InsertOneOptionsgetOptions()Deprecated, for removal: This API element is subject to removal in a future version.InsertOneOptionsoptions()booleanunsetMissing()Deprecated, for removal: This API element is subject to removal in a future version.InsertOneOptionsunsetMissing(boolean unset)Applies the rules for storing null/empty values for fields no present in the object to be merged.WriteConcernwriteConcern()The write concern to use for the insertion.InsertOneOptionswriteConcern(WriteConcern writeConcern)Set the write concern to use for the insert.
-
-
-
Constructor Detail
-
InsertOneOptions
public InsertOneOptions()
Creates a new options wrapper
-
InsertOneOptions
@MorphiaInternal public InsertOneOptions(InsertOneOptions 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 InsertOneOptions bypassDocumentValidation(@Nullable 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 InsertOneOptions collection(@Nullable String collection)
Specifies an alternate collection to use rather than the mapped collection.- Specified by:
collectionin interfacedev.morphia.internal.CollectionConfigurable<InsertOneOptions>- Parameters:
collection- the name of the collection to use- Returns:
- the options
-
collection
@MorphiaInternal public String collection()
Description copied from interface:dev.morphia.internal.CollectionConfigurableReturns the alternate collection to use for the operation. Might return null.- Specified by:
collectionin interfacedev.morphia.internal.CollectionConfigurable<InsertOneOptions>- Returns:
- the collection
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
comment
public InsertOneOptions comment(String comment)
- Parameters:
comment- the comment- Returns:
- this
- Since:
- 2.3
- See Also:
InsertOneOptions.comment(String)
-
comment
public InsertOneOptions comment(BsonValue comment)
- Parameters:
comment- the comment- Returns:
- this
- Since:
- 2.3
- See Also:
InsertOneOptions.comment(BsonValue)
-
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 the the bypass document level validation flag- Returns:
- the bypass document level validation flag
-
bypassDocumentValidation
@Nullable @MorphiaInternal public Boolean bypassDocumentValidation()
- Returns:
- the bypass document level validation flag
- See Also:
InsertOneOptions.getBypassDocumentValidation()
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getOptions
@Deprecated(forRemoval=true, since="2.3") public InsertOneOptions getOptions()
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the driver version of the options
-
options
@MorphiaInternal public InsertOneOptions options()
- Returns:
- the driver version of the options
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
unsetMissing
@Deprecated(forRemoval=true, since="2.3") public boolean unsetMissing()
Deprecated, for removal: This API element is subject to removal in a future version.Applies the rules for storing null/empty values for fields not present in the object to be merged.- Returns:
- this true if the rules for storing null/empty values should be applied
- Since:
- 2.2
-
unsetMissing
public InsertOneOptions unsetMissing(boolean unset)
Applies the rules for storing null/empty values for fields no present in the object to be merged.- Parameters:
unset- true if the rules should be applied- Returns:
- this
- Since:
- 2.2
-
writeConcern
public InsertOneOptions writeConcern(@Nullable WriteConcern writeConcern)
Set the write concern to use for the insert.- Specified by:
writeConcernin interfacedev.morphia.internal.WriteConfigurable<InsertOneOptions>- Parameters:
writeConcern- the write concern- Returns:
- this
-
writeConcern
@Nullable public WriteConcern writeConcern()
The write concern to use for the insertion. By default the write concern configured for the MongoCollection instance will be used.- Specified by:
writeConcernin interfacedev.morphia.internal.WriteConfigurable<InsertOneOptions>- Returns:
- the write concern, or null if the default will be used.
-
-