public abstract class BaseWriteOperation extends Object implements AsyncWriteOperation<WriteConcernResult>, WriteOperation<WriteConcernResult>
Constructor and Description |
---|
BaseWriteOperation(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern)
Construct an instance
|
Modifier and Type | Method and Description |
---|---|
BaseWriteOperation |
bypassDocumentValidation(Boolean bypassDocumentValidation)
Sets the bypass document level validation flag.
|
WriteConcernResult |
execute(WriteBinding binding)
General execute which can return anything of type T
|
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<WriteConcernResult> callback)
General execute which can return anything of type T
|
protected abstract BulkWriteResult |
executeCommandProtocol(Connection connection)
Executes the write command protocol.
|
protected abstract void |
executeCommandProtocolAsync(AsyncConnection connection,
SingleResultCallback<BulkWriteResult> callback)
Asynchronously executes the write command protocol.
|
protected abstract WriteConcernResult |
executeProtocol(Connection connection)
Executes the write protocol
|
protected abstract void |
executeProtocolAsync(AsyncConnection connection,
SingleResultCallback<WriteConcernResult> callback)
Asynchronously executes the write protocol
|
Boolean |
getBypassDocumentValidation()
Gets the the bypass document level validation flag
|
protected abstract int |
getCount(BulkWriteResult bulkWriteResult) |
MongoNamespace |
getNamespace()
Gets the namespace of the collection to write to.
|
protected abstract WriteRequest.Type |
getType() |
protected boolean |
getUpdatedExisting(BulkWriteResult bulkWriteResult) |
WriteConcern |
getWriteConcern()
Gets the write concern to apply
|
boolean |
isOrdered()
Gets whether the writes are ordered.
|
public BaseWriteOperation(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern)
namespace
- the database and collection namespace for the operation.ordered
- whether the writes are ordered.writeConcern
- the write concern for the operation.public MongoNamespace getNamespace()
public WriteConcern getWriteConcern()
public boolean isOrdered()
public Boolean getBypassDocumentValidation()
public BaseWriteOperation bypassDocumentValidation(Boolean bypassDocumentValidation)
bypassDocumentValidation
- If true, allows the write to opt-out of document level validation.public WriteConcernResult execute(WriteBinding binding)
WriteOperation
execute
in interface WriteOperation<WriteConcernResult>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<WriteConcernResult> callback)
AsyncWriteOperation
executeAsync
in interface AsyncWriteOperation<WriteConcernResult>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executedprotected abstract WriteConcernResult executeProtocol(Connection connection)
connection
- the connectionprotected abstract void executeProtocolAsync(AsyncConnection connection, SingleResultCallback<WriteConcernResult> callback)
connection
- the connectioncallback
- the callback to be passed the WriteConcernResultprotected abstract BulkWriteResult executeCommandProtocol(Connection connection)
connection
- the connectionprotected abstract void executeCommandProtocolAsync(AsyncConnection connection, SingleResultCallback<BulkWriteResult> callback)
connection
- the connectioncallback
- the callback to be passed the BulkWriteResultprotected abstract WriteRequest.Type getType()
protected abstract int getCount(BulkWriteResult bulkWriteResult)
protected boolean getUpdatedExisting(BulkWriteResult bulkWriteResult)