T - the operations result type.AsyncWriteOperation<T>, WriteOperation<T>public class FindAndDeleteOperation<T> extends Object
| Constructor | Description |
|---|---|
FindAndDeleteOperation(MongoNamespace namespace,
WriteConcern writeConcern,
boolean retryWrites,
Decoder<T> decoder) |
Construct a new instance.
|
FindAndDeleteOperation(MongoNamespace namespace,
WriteConcern writeConcern,
Decoder<T> decoder) |
Deprecated.
|
FindAndDeleteOperation(MongoNamespace namespace,
Decoder<T> decoder) |
Deprecated.
|
| Modifier and Type | Method | Description |
|---|---|---|
FindAndDeleteOperation<T> |
collation(Collation collation) |
Sets the collation options
|
T |
execute(WriteBinding binding) |
General execute which can return anything of type T
|
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<T> callback) |
General execute which can return anything of type T
|
FindAndDeleteOperation<T> |
filter(BsonDocument filter) |
Sets the filter to apply to the query.
|
Collation |
getCollation() |
Returns the collation options
|
protected com.mongodb.operation.CommandOperationHelper.CommandCreator |
getCommandCreator(SessionContext sessionContext) |
|
protected String |
getDatabaseName() |
|
Decoder<T> |
getDecoder() |
Gets the decoder used to decode the result documents.
|
protected FieldNameValidator |
getFieldNameValidator() |
|
BsonDocument |
getFilter() |
Gets the query filter.
|
long |
getMaxTime(TimeUnit timeUnit) |
Gets the maximum execution time on the server for this operation.
|
MongoNamespace |
getNamespace() |
Gets the namespace.
|
BsonDocument |
getProjection() |
Gets a document describing the fields to return for all matching documents.
|
BsonDocument |
getSort() |
Gets the sort criteria to apply to the query.
|
WriteConcern |
getWriteConcern() |
Get the write concern for this operation
|
FindAndDeleteOperation<T> |
maxTime(long maxTime,
TimeUnit timeUnit) |
Sets the maximum execution time on the server for this operation.
|
FindAndDeleteOperation<T> |
projection(BsonDocument projection) |
Sets a document describing the fields to return for all matching documents.
|
FindAndDeleteOperation<T> |
sort(BsonDocument sort) |
Sets the sort criteria to apply to the query.
|
@Deprecated public FindAndDeleteOperation(MongoNamespace namespace, Decoder<T> decoder)
FindAndDeleteOperation(MongoNamespace, WriteConcern, boolean, Decoder) insteadnamespace - the database and collection namespace for the operation.decoder - the decoder for the result documents.@Deprecated public FindAndDeleteOperation(MongoNamespace namespace, WriteConcern writeConcern, Decoder<T> decoder)
FindAndDeleteOperation(MongoNamespace, WriteConcern, boolean, Decoder) insteadnamespace - the database and collection namespace for the operation.writeConcern - the writeConcern for the operationdecoder - the decoder for the result documents.public FindAndDeleteOperation(MongoNamespace namespace, WriteConcern writeConcern, boolean retryWrites, Decoder<T> decoder)
namespace - the database and collection namespace for the operation.writeConcern - the writeConcern for the operationretryWrites - if writes should be retried if they fail due to a network error.decoder - the decoder for the result documents.public MongoNamespace getNamespace()
public WriteConcern getWriteConcern()
WriteConcernpublic Decoder<T> getDecoder()
public BsonDocument getFilter()
public FindAndDeleteOperation<T> filter(BsonDocument filter)
filter - the filter, which may be null.public BsonDocument getProjection()
public FindAndDeleteOperation<T> projection(BsonDocument projection)
projection - the project document, which may be null.public long getMaxTime(TimeUnit timeUnit)
timeUnit - the time unit to return the result inpublic FindAndDeleteOperation<T> maxTime(long maxTime, TimeUnit timeUnit)
maxTime - the max timetimeUnit - the time unit, which may not be nullpublic BsonDocument getSort()
public FindAndDeleteOperation<T> sort(BsonDocument sort)
sort - the sort criteria, which may be null.public Collation getCollation()
public FindAndDeleteOperation<T> collation(Collation collation)
A null value represents the server default.
collation - the collation options to useprotected String getDatabaseName()
protected com.mongodb.operation.CommandOperationHelper.CommandCreator getCommandCreator(SessionContext sessionContext)
protected FieldNameValidator getFieldNameValidator()
public T execute(WriteBinding binding)
WriteOperationexecute in interface WriteOperation<T>binding - the binding to execute in the context ofpublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<T> callback)
AsyncWriteOperationexecuteAsync in interface AsyncWriteOperation<T>binding - the binding to execute in the context ofcallback - the callback to be called when the operation has been executed