Package dev.morphia
Class InsertOptions
- java.lang.Object
-
- dev.morphia.InsertOptions
-
public class InsertOptions extends java.lang.Object
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 InsertOptions()
Creates a new options instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description InsertOptions
bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets whether to bypass document validation.InsertOptions
continueOnError(boolean continueOnError)
Deprecated.this value is not supported in 2.0InsertOptions
copy()
Create a copy of the options instance.java.lang.Boolean
getBypassDocumentValidation()
Gets whether to bypass document validation, or null if unspecified.com.mongodb.WriteConcern
getWriteConcern()
The write concern to use for the insertion.boolean
isContinueOnError()
Deprecated.this value is not supported in 2.0InsertOptions
writeConcern(com.mongodb.WriteConcern writeConcern)
Set the write concern to use for the insert.
-
-
-
Method Detail
-
copy
public InsertOptions copy()
Create a copy of the options instance.- Returns:
- the copy
-
writeConcern
public InsertOptions writeConcern(com.mongodb.WriteConcern writeConcern)
Set the write concern to use for the insert.- Parameters:
writeConcern
- the write concern- Returns:
- this
-
continueOnError
@Deprecated public InsertOptions continueOnError(boolean continueOnError)
Deprecated.this value is not supported in 2.0Set whether documents will continue to be inserted after a failure to insert one.- Parameters:
continueOnError
- whether to continue on error- Returns:
- this
-
getWriteConcern
public com.mongodb.WriteConcern getWriteConcern()
The write concern to use for the insertion. By default the write concern configured for the DBCollection instance will be used.- Returns:
- the write concern, or null if the default will be used.
-
isContinueOnError
@Deprecated public boolean isContinueOnError()
Deprecated.this value is not supported in 2.0Whether documents will continue to be inserted after a failure to insert one (most commonly due to a duplicate key error). Note that this only is relevant for multi-document inserts. The default value is false.- Returns:
- whether insertion will continue on error.
-
getBypassDocumentValidation
public java.lang.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
-
bypassDocumentValidation
public InsertOptions bypassDocumentValidation(java.lang.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
-
-