Method CountDocuments
CountDocuments(CancellationToken)
Counts the number of documents.
long CountDocuments(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe 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 |
+-------------+--------------------------------+