Method DeleteMany
DeleteMany<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CancellationToken)
Deletes multiple documents.
public static DeleteResult DeleteMany<TDocument>(this IMongoCollection<TDocument> collection, Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken = default)
Parameters
collectionIMongoCollection<TDocument>The collection.
filterExpression<Func<TDocument, bool>>The filter.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- DeleteResult
The result of the delete operation.
Type Parameters
TDocumentThe type of the document.
DeleteMany<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)
Deletes multiple documents.
public static DeleteResult DeleteMany<TDocument>(this IMongoCollection<TDocument> collection, Expression<Func<TDocument, bool>> filter, DeleteOptions options, CancellationToken cancellationToken = default)
Parameters
collectionIMongoCollection<TDocument>The collection.
filterExpression<Func<TDocument, bool>>The filter.
optionsDeleteOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- DeleteResult
The result of the delete operation.
Type Parameters
TDocumentThe type of the document.
DeleteMany<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)
Deletes multiple documents.
public static DeleteResult DeleteMany<TDocument>(this IMongoCollection<TDocument> collection, IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, DeleteOptions options = null, CancellationToken cancellationToken = default)
Parameters
collectionIMongoCollection<TDocument>The collection.
sessionIClientSessionHandleThe session.
filterExpression<Func<TDocument, bool>>The filter.
optionsDeleteOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- DeleteResult
The result of the delete operation.
Type Parameters
TDocumentThe type of the document.