Method CountDocuments
CountDocuments(CancellationToken)
Counts the number of documents.
public virtual long CountDocuments(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- long
 The count.
Remarks
Note: when migrating from Count to CountDocuments the following query operations must be replaced:
+-------------+--------------------------------+
| Operator    | Replacement                    |
+=============+================================+
| $where      |  $expr                         |
+-------------+--------------------------------+
| $near       |  $geoWithin with $center       |
+-------------+--------------------------------+
| $nearSphere |  $geoWithin with $centerSphere |
+-------------+--------------------------------+