Method DeleteManyAsync
DeleteManyAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CancellationToken)
Deletes multiple documents.
public static Task<DeleteResult> DeleteManyAsync<TDocument>(this IMongoCollection<TDocument> collection, Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection <TDocument>The collection.
filter
Expression<Func<TDocument, bool>>The filter.
cancellationToken
CancellationToken The cancellation token.
Returns
- Task<Delete
Result > The result of the delete operation.
Type Parameters
TDocument
The type of the document.
DeleteManyAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)
Deletes multiple documents.
public static Task<DeleteResult> DeleteManyAsync<TDocument>(this IMongoCollection<TDocument> collection, Expression<Func<TDocument, bool>> filter, DeleteOptions options, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection <TDocument>The collection.
filter
Expression<Func<TDocument, bool>>The filter.
options
DeleteOptions The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Task<Delete
Result > The result of the delete operation.
Type Parameters
TDocument
The type of the document.
DeleteManyAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)
Deletes multiple documents.
public static Task<DeleteResult> DeleteManyAsync<TDocument>(this IMongoCollection<TDocument> collection, IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, DeleteOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection <TDocument>The collection.
session
IClientSession Handle The session.
filter
Expression<Func<TDocument, bool>>The filter.
options
DeleteOptions The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Task<Delete
Result > The result of the delete operation.
Type Parameters
TDocument
The type of the document.