IMongoCollectionTDocumentCountAsync Method |
Counts the number of documents in the collection.
Namespace: MongoDB.DriverAssembly: MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.1.0
Syntax Task<long> CountAsync(
FilterDefinition<TDocument> filter,
CountOptions options = null,
CancellationToken cancellationToken = null
)
Function CountAsync (
filter As FilterDefinition(Of TDocument),
Optional options As CountOptions = Nothing,
Optional cancellationToken As CancellationToken = Nothing
) As Task(Of Long)
abstract CountAsync :
filter : FilterDefinition<'TDocument> *
?options : CountOptions *
?cancellationToken : CancellationToken
(* Defaults:
let _options = defaultArg options null
let _cancellationToken = defaultArg cancellationToken null
*)
-> Task<int64>
Parameters
- filter
- Type: MongoDB.DriverFilterDefinitionTDocument
The filter. - options (Optional)
- Type: MongoDB.DriverCountOptions
The options. - cancellationToken (Optional)
- Type: System.ThreadingCancellationToken
The cancellation token.
Return Value
Type:
TaskInt64
The number of documents in the collection.
See Also