public abstract class BaseWriteOperation extends java.lang.Object implements AsyncWriteOperation<WriteConcernResult>, WriteOperation<WriteConcernResult>
Modifier and Type | Field and Description |
---|---|
private java.lang.Boolean |
bypassDocumentValidation |
private MongoNamespace |
namespace |
private boolean |
ordered |
private boolean |
retryWrites |
private WriteConcern |
writeConcern |
Constructor and Description |
---|
BaseWriteOperation(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern)
Deprecated.
|
BaseWriteOperation(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
boolean retryWrites)
Construct an instance
|
Modifier and Type | Method and Description |
---|---|
private void |
addBulkWriteResultToResponse(BulkWriteResult bulkWriteResult,
BsonDocument response) |
BaseWriteOperation |
bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets the bypass document level validation flag.
|
private MongoException |
convertBulkWriteException(MongoBulkWriteException e) |
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
|
java.lang.Boolean |
getBypassDocumentValidation()
Gets the the bypass document level validation flag
|
private int |
getCount(BulkWriteResult bulkWriteResult) |
private BulkWriteError |
getLastError(MongoBulkWriteException e) |
private MixedBulkWriteOperation |
getMixedBulkOperation() |
MongoNamespace |
getNamespace()
Gets the namespace of the collection to write to.
|
protected abstract WriteRequest.Type |
getType() |
private boolean |
getUpdatedExisting(BulkWriteResult bulkWriteResult) |
WriteConcern |
getWriteConcern()
Gets the write concern to apply
|
protected abstract java.util.List<? extends WriteRequest> |
getWriteRequests() |
boolean |
isOrdered()
Gets whether the writes are ordered.
|
private BsonDocument |
manufactureGetLastErrorResponse(MongoBulkWriteException e) |
private WriteConcernResult |
translateBulkWriteResult(BulkWriteResult bulkWriteResult) |
private final WriteConcern writeConcern
private final MongoNamespace namespace
private final boolean ordered
private final boolean retryWrites
private java.lang.Boolean bypassDocumentValidation
@Deprecated public BaseWriteOperation(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern)
BaseWriteOperation(MongoNamespace, boolean, WriteConcern, boolean)
insteadnamespace
- the database and collection namespace for the operation.ordered
- whether the writes are ordered.writeConcern
- the write concern for the operation.public BaseWriteOperation(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, boolean retryWrites)
namespace
- the database and collection namespace for the operation.ordered
- whether the writes are ordered.writeConcern
- the write concern for the operation.retryWrites
- if writes should be retried if they fail due to a network error.protected abstract java.util.List<? extends WriteRequest> getWriteRequests()
protected abstract WriteRequest.Type getType()
public MongoNamespace getNamespace()
public WriteConcern getWriteConcern()
public boolean isOrdered()
public java.lang.Boolean getBypassDocumentValidation()
public BaseWriteOperation bypassDocumentValidation(java.lang.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 executedprivate MixedBulkWriteOperation getMixedBulkOperation()
private MongoException convertBulkWriteException(MongoBulkWriteException e)
private BsonDocument manufactureGetLastErrorResponse(MongoBulkWriteException e)
private void addBulkWriteResultToResponse(BulkWriteResult bulkWriteResult, BsonDocument response)
private WriteConcernResult translateBulkWriteResult(BulkWriteResult bulkWriteResult)
private int getCount(BulkWriteResult bulkWriteResult)
private boolean getUpdatedExisting(BulkWriteResult bulkWriteResult)
private BulkWriteError getLastError(MongoBulkWriteException e)