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