Package dev.morphia
Class InsertOneOptions
- java.lang.Object
-
- dev.morphia.InsertOneOptions
-
- All Implemented Interfaces:
SessionConfigurable<InsertOneOptions>
,WriteConfigurable<InsertOneOptions>
public class InsertOneOptions extends Object implements SessionConfigurable<InsertOneOptions>, WriteConfigurable<InsertOneOptions>
Options related to insertion of documents into MongoDB. The setter methods returnthis
so 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 Modifier and Type Method Description InsertOneOptions
bypassDocumentValidation(Boolean bypassDocumentValidation)
Sets whether to bypass document validation.com.mongodb.client.ClientSession
clientSession()
The client session to use for the insertion.InsertOneOptions
clientSession(com.mongodb.client.ClientSession clientSession)
Set the client session to use for the insert.Boolean
getBypassDocumentValidation()
Gets the the bypass document level validation flagcom.mongodb.client.model.InsertOneOptions
getOptions()
boolean
unsetMissing()
Applies the rules for storing null/empty values for fields not present in the object to be merged.InsertOneOptions
unsetMissing(boolean unset)
Applies the rules for storing null/empty values for fields no present in the object to be merged.com.mongodb.WriteConcern
writeConcern()
The write concern to use for the insertion.InsertOneOptions
writeConcern(com.mongodb.WriteConcern writeConcern)
Set the write concern to use for the insert.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface dev.morphia.internal.WriteConfigurable
getWriteConcern, prepare
-
-
-
-
Constructor Detail
-
InsertOneOptions
public InsertOneOptions()
Creates a new options wrapper
-
InsertOneOptions
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
-
clientSession
public com.mongodb.client.ClientSession clientSession()
Description copied from interface:SessionConfigurable
The client session to use for the insertion.- Specified by:
clientSession
in interfaceSessionConfigurable<InsertOneOptions>
- Returns:
- the client session
-
clientSession
public InsertOneOptions clientSession(@Nullable com.mongodb.client.ClientSession clientSession)
Description copied from interface:SessionConfigurable
Set the client session to use for the insert.- Specified by:
clientSession
in interfaceSessionConfigurable<InsertOneOptions>
- Parameters:
clientSession
- the client session- Returns:
- this
-
getBypassDocumentValidation
@Nullable public Boolean getBypassDocumentValidation()
Gets the the bypass document level validation flag- Returns:
- the bypass document level validation flag
-
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
-
unsetMissing
public boolean unsetMissing()
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
-
writeConcern
public InsertOneOptions writeConcern(@Nullable com.mongodb.WriteConcern writeConcern)
Set the write concern to use for the insert.- Specified by:
writeConcern
in interfaceWriteConfigurable<InsertOneOptions>
- Parameters:
writeConcern
- the write concern- Returns:
- this
-
writeConcern
@Nullable public com.mongodb.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:
writeConcern
in interfaceWriteConfigurable<InsertOneOptions>
- Returns:
- the write concern, or null if the default will be used.
-
getOptions
public com.mongodb.client.model.InsertOneOptions getOptions()
- Returns:
- the driver version of the options
-
-