public class MixedBulkWriteOperation extends java.lang.Object implements AsyncWriteOperation<BulkWriteResult>, WriteOperation<BulkWriteResult>
Modifier and Type | Class and Description |
---|---|
private class |
MixedBulkWriteOperation.OrderedRunGenerator |
private class |
MixedBulkWriteOperation.Run |
private class |
MixedBulkWriteOperation.UnorderedRunGenerator |
Modifier and Type | Field and Description |
---|---|
private java.lang.Boolean |
bypassDocumentValidation |
private static java.util.List<java.lang.String> |
IGNORED_KEYS |
private MongoNamespace |
namespace |
private boolean |
ordered |
private WriteConcern |
writeConcern |
private java.util.List<? extends WriteRequest> |
writeRequests |
Constructor and Description |
---|
MixedBulkWriteOperation(MongoNamespace namespace,
java.util.List<? extends WriteRequest> writeRequests,
boolean ordered,
WriteConcern writeConcern)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
MixedBulkWriteOperation |
bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets the bypass document level validation flag.
|
BulkWriteResult |
execute(WriteBinding binding)
Executes a bulk write operation.
|
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<BulkWriteResult> callback)
General execute which can return anything of type T
|
private void |
executeRunsAsync(java.util.Iterator<MixedBulkWriteOperation.Run> runs,
AsyncConnection connection,
BulkWriteBatchCombiner bulkWriteBatchCombiner,
SingleResultCallback<BulkWriteResult> callback) |
java.lang.Boolean |
getBypassDocumentValidation()
Gets the the bypass document level validation flag
|
MongoNamespace |
getNamespace()
Gets the namespace of the collection to write to.
|
private java.lang.Iterable<MixedBulkWriteOperation.Run> |
getRunGenerator(ConnectionDescription connectionDescription) |
WriteConcern |
getWriteConcern()
Gets the write concern to apply
|
java.util.List<? extends WriteRequest> |
getWriteRequests()
Gets the list of write requests to execute.
|
boolean |
isOrdered()
Gets whether the writes are ordered.
|
private boolean |
serverSupportsWriteCommands(ConnectionDescription connectionDescription) |
private boolean |
shouldUseWriteCommands(ConnectionDescription description) |
private final MongoNamespace namespace
private final java.util.List<? extends WriteRequest> writeRequests
private final boolean ordered
private final WriteConcern writeConcern
private java.lang.Boolean bypassDocumentValidation
private static final java.util.List<java.lang.String> IGNORED_KEYS
public MixedBulkWriteOperation(MongoNamespace namespace, java.util.List<? extends WriteRequest> writeRequests, boolean ordered, WriteConcern writeConcern)
namespace
- the database and collection namespace for the operation.writeRequests
- the list of writeRequests to execute.ordered
- whether the writeRequests must be executed in order.writeConcern
- the write concern for the operation.public MongoNamespace getNamespace()
public WriteConcern getWriteConcern()
public boolean isOrdered()
public java.util.List<? extends WriteRequest> getWriteRequests()
public java.lang.Boolean getBypassDocumentValidation()
public MixedBulkWriteOperation bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
bypassDocumentValidation
- If true, allows the write to opt-out of document level validation.public BulkWriteResult execute(WriteBinding binding)
execute
in interface WriteOperation<BulkWriteResult>
binding
- the WriteBinding for the operationMongoBulkWriteException
- if a failure to complete the bulk write is detected based on the server responsepublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<BulkWriteResult> callback)
AsyncWriteOperation
executeAsync
in interface AsyncWriteOperation<BulkWriteResult>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executedprivate void executeRunsAsync(java.util.Iterator<MixedBulkWriteOperation.Run> runs, AsyncConnection connection, BulkWriteBatchCombiner bulkWriteBatchCombiner, SingleResultCallback<BulkWriteResult> callback)
private boolean shouldUseWriteCommands(ConnectionDescription description)
private boolean serverSupportsWriteCommands(ConnectionDescription connectionDescription)
private java.lang.Iterable<MixedBulkWriteOperation.Run> getRunGenerator(ConnectionDescription connectionDescription)