Method FindOneAndDeleteAsync
FindOneAndDeleteAsync<TProjection>(FilterDefinition<TDocument>, FindOneAndDeleteOptions<TDocument, TProjection>, CancellationToken)
Finds a single document and deletes it atomically.
Task<TProjection> FindOneAndDeleteAsync<TProjection>(FilterDefinition<TDocument> filter, FindOneAndDeleteOptions<TDocument, TProjection> options = null, CancellationToken cancellationToken = default)
Parameters
filter
FilterDefinition<TDocument>The filter.
options
FindOneAndDeleteOptions<TDocument, TProjection>The options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<TProjection>
The returned document.
Type Parameters
TProjection
The type of the projection (same as TDocument if there is no projection).
FindOneAndDeleteAsync<TProjection>(IClientSessionHandle, FilterDefinition<TDocument>, FindOneAndDeleteOptions<TDocument, TProjection>, CancellationToken)
Finds a single document and deletes it atomically.
Task<TProjection> FindOneAndDeleteAsync<TProjection>(IClientSessionHandle session, FilterDefinition<TDocument> filter, FindOneAndDeleteOptions<TDocument, TProjection> options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
filter
FilterDefinition<TDocument>The filter.
options
FindOneAndDeleteOptions<TDocument, TProjection>The options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<TProjection>
The returned document.
Type Parameters
TProjection
The type of the projection (same as TDocument if there is no projection).