Method Count
Count(FilterDefinition<TDocument>, CountOptions, CancellationToken)
Counts the number of documents in the collection.
[Obsolete("Use CountDocuments or EstimatedDocumentCount instead.")]
public virtual long Count(FilterDefinition<TDocument> filter, CountOptions options = null, CancellationToken cancellationToken = default)
Parameters
filter
FilterDefinition<TDocument>The filter.
options
CountOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- long
The number of documents in the collection.
Count(IClientSessionHandle, FilterDefinition<TDocument>, CountOptions, CancellationToken)
Counts the number of documents in the collection.
[Obsolete("Use CountDocuments or EstimatedDocumentCount instead.")]
public virtual long Count(IClientSessionHandle session, FilterDefinition<TDocument> filter, CountOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
filter
FilterDefinition<TDocument>The filter.
options
CountOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- long
The number of documents in the collection.