Package com.mongodb.client.model
Class InsertOneOptions
java.lang.Object
com.mongodb.client.model.InsertOneOptions
The options to apply to an operation that inserts a single document into a collection.
- Since:
- 3.2
- MongoDB documentation
- Insert Tutorial
- Insert Command
- Since server release
- 3.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbypassDocumentValidation
(Boolean bypassDocumentValidation) Sets the bypass document level validation flag.Sets the comment for this operation.comment
(org.bson.BsonValue comment) Sets the comment for this operation.Gets the bypass document level validation flagorg.bson.BsonValue
toString()
-
Constructor Details
-
InsertOneOptions
public InsertOneOptions()
-
-
Method Details
-
getBypassDocumentValidation
Gets the bypass document level validation flag- Returns:
- the bypass document level validation flag
-
bypassDocumentValidation
Sets the bypass document level validation flag.For bulk operations use:
BulkWriteOptions.bypassDocumentValidation(Boolean)
- Parameters:
bypassDocumentValidation
- If true, allows the write to opt-out of document level validation.- Returns:
- this
-
getComment
- Returns:
- the comment for this operation. A null value means no comment is set.
- Since:
- 4.6
- Since server release
- 4.4
-
comment
Sets the comment for this operation. A null value means no comment is set.For bulk operations use:
BulkWriteOptions.comment(String)
- Parameters:
comment
- the comment- Returns:
- this
- Since:
- 4.6
- Since server release
- 4.4
-
comment
Sets the comment for this operation. A null value means no comment is set.For bulk operations use:
BulkWriteOptions.comment(BsonValue)
- Parameters:
comment
- the comment- Returns:
- this
- Since:
- 4.6
- Since server release
- 4.4
-
toString
-