Method DeleteManyAsync
| MongoDB CSharp Driver API Reference (original) (raw)
Namespace
Assembly
MongoDB.Driver.dll
DeleteManyAsync(IMongoCollection, 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
The collection.
filter Expression<Func<TDocument, bool>>
The filter.
cancellationToken CancellationToken
The cancellation token.
Returns
The result of the delete operation.
Type Parameters
TDocument
The type of the document.
DeleteManyAsync(IMongoCollection, 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
The collection.
filter Expression<Func<TDocument, bool>>
The filter.
options DeleteOptions
The options.
cancellationToken CancellationToken
The cancellation token.
Returns
The result of the delete operation.
Type Parameters
TDocument
The type of the document.
DeleteManyAsync(IMongoCollection, 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
The collection.
session IClientSessionHandle
The session.
filter Expression<Func<TDocument, bool>>
The filter.
options DeleteOptions
The options.
cancellationToken CancellationToken
The cancellation token.
Returns
The result of the delete operation.
Type Parameters
TDocument
The type of the document.