Method FindOneAndDelete
FindOneAndDelete<TProjection>(FilterDefinition<TDocument>, FindOneAndDeleteOptions<TDocument, TProjection>, CancellationToken)
Finds a single document and deletes it atomically.
TProjection FindOneAndDelete<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
- TProjection
The returned document.
Type Parameters
TProjection
The type of the projection (same as TDocument if there is no projection).
FindOneAndDelete<TProjection>(IClientSessionHandle, FilterDefinition<TDocument>, FindOneAndDeleteOptions<TDocument, TProjection>, CancellationToken)
Finds a single document and deletes it atomically.
TProjection FindOneAndDelete<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
- TProjection
The returned document.
Type Parameters
TProjection
The type of the projection (same as TDocument if there is no projection).