Package dev.morphia
Class InsertManyOptions
- java.lang.Object
-
- dev.morphia.InsertManyOptions
-
- All Implemented Interfaces:
dev.morphia.internal.SessionConfigurable<InsertManyOptions>
,dev.morphia.internal.WriteConfigurable<InsertManyOptions>
public class InsertManyOptions extends Object implements dev.morphia.internal.SessionConfigurable<InsertManyOptions>, dev.morphia.internal.WriteConfigurable<InsertManyOptions>
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 InsertManyOptions()
Creates a new options wrapperInsertManyOptions(InsertManyOptions that)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description InsertManyOptions
bypassDocumentValidation(Boolean bypassDocumentValidation)
Sets whether to bypass document validation.com.mongodb.client.ClientSession
clientSession()
The client session to use for the insertion.InsertManyOptions
clientSession(com.mongodb.client.ClientSession clientSession)
Set the client session to use for the insert.Boolean
getBypassDocumentValidation()
Gets whether to bypass document validation, or null if unspecified.com.mongodb.client.model.InsertManyOptions
getOptions()
com.mongodb.WriteConcern
getWriteConcern()
Deprecated, for removal: This API element is subject to removal in a future version.boolean
isOrdered()
Gets whether the documents should be inserted in the order provided, stopping on the first failed insertion.InsertManyOptions
ordered(boolean ordered)
Sets whether the server should insert the documents in the order provided.com.mongodb.WriteConcern
writeConcern()
The write concern to use.InsertManyOptions
writeConcern(com.mongodb.WriteConcern writeConcern)
Set the write concern to use.
-
-
-
Constructor Detail
-
InsertManyOptions
public InsertManyOptions()
Creates a new options wrapper
-
InsertManyOptions
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
-
clientSession
public InsertManyOptions clientSession(com.mongodb.client.ClientSession clientSession)
Set the client session to use for the insert.- Specified by:
clientSession
in interfacedev.morphia.internal.SessionConfigurable<InsertManyOptions>
- Parameters:
clientSession
- the client session- Returns:
- this
-
clientSession
public com.mongodb.client.ClientSession clientSession()
The client session to use for the insertion.- Specified by:
clientSession
in interfacedev.morphia.internal.SessionConfigurable<InsertManyOptions>
- Returns:
- the client session
-
getBypassDocumentValidation
public Boolean getBypassDocumentValidation()
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
-
getOptions
public com.mongodb.client.model.InsertManyOptions getOptions()
- Returns:
- the driver version of this instance
-
getWriteConcern
@Deprecated(since="2.0", forRemoval=true) public com.mongodb.WriteConcern getWriteConcern()
Deprecated, for removal: This API element is subject to removal in a future version.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:
getWriteConcern
in interfacedev.morphia.internal.WriteConfigurable<InsertManyOptions>
- Returns:
- the write concern, or null if the default will be used.
-
isOrdered
public boolean isOrdered()
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
-
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
-
writeConcern
public InsertManyOptions writeConcern(com.mongodb.WriteConcern writeConcern)
Description copied from interface:dev.morphia.internal.WriteConfigurable
Set the write concern to use.- Specified by:
writeConcern
in interfacedev.morphia.internal.WriteConfigurable<InsertManyOptions>
- Parameters:
writeConcern
- the write concern- Returns:
- this
-
writeConcern
public com.mongodb.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 interfacedev.morphia.internal.WriteConfigurable<InsertManyOptions>
- Returns:
- the write concern, or null if the default will be used.
-
-