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
FindOne <TDocument, TProjection>And Delete Options The options.
cancellationToken
CancellationToken The 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
IClientSession Handle The session.
filter
FilterDefinition <TDocument>The filter.
options
FindOne <TDocument, TProjection>And Delete Options The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Task<TProjection>
The returned document.
Type Parameters
TProjection
The type of the projection (same as TDocument if there is no projection).