public class BulkWriteOperation
extends java.lang.Object
DBCollection.initializeOrderedBulkOperation(),
DBCollection.initializeUnorderedBulkOperation()| Modifier and Type | Field and Description |
|---|---|
private java.lang.Boolean |
bypassDocumentValidation |
private boolean |
closed |
private DBCollection |
collection |
private static java.lang.String |
ID_FIELD_NAME |
private boolean |
ordered |
private java.util.List<WriteRequest> |
requests |
| Constructor and Description |
|---|
BulkWriteOperation(boolean ordered,
DBCollection collection) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addRequest(WriteRequest request) |
BulkWriteResult |
execute()
Execute the bulk write operation with the default write concern of the collection from which this came.
|
BulkWriteResult |
execute(WriteConcern writeConcern)
Execute the bulk write operation with the given write concern.
|
BulkWriteRequestBuilder |
find(DBObject query)
Start building a write request to add to the bulk write operation.
|
java.lang.Boolean |
getBypassDocumentValidation()
Gets whether to bypass document validation, or null if unspecified.
|
void |
insert(DBObject document)
Add an insert request to the bulk operation
|
boolean |
isOrdered()
Returns true if this is building an ordered bulk write request.
|
void |
setBypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets whether to bypass document validation.
|
private static final java.lang.String ID_FIELD_NAME
private final boolean ordered
private final DBCollection collection
private final java.util.List<WriteRequest> requests
private java.lang.Boolean bypassDocumentValidation
private boolean closed
BulkWriteOperation(boolean ordered,
DBCollection collection)
public boolean isOrdered()
DBCollection.initializeOrderedBulkOperation(),
DBCollection.initializeUnorderedBulkOperation()public java.lang.Boolean getBypassDocumentValidation()
public void setBypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
bypassDocumentValidation - whether to bypass document validation, or null if unspecifiedpublic void insert(DBObject document)
document - the document to insertpublic BulkWriteRequestBuilder find(DBObject query)
query - the query for an update, replace or remove requestpublic BulkWriteResult execute()
BulkWriteException - if the write failed due some other failure specific to the write commandMongoException - if the operation failed for some other reasonpublic BulkWriteResult execute(WriteConcern writeConcern)
writeConcern - the write concern to apply to the bulk operation.BulkWriteException - if the write failed due some other failure specific to the write commandMongoException - if the operation failed for some other reasonvoid addRequest(WriteRequest request)