count Documents
Counts the number of documents in the collection.
Note: When migrating from count() to countDocuments() the following query operators must be replaced:
+-------------+--------------------------------+
| Operator | Replacement |
+=============+================================+
| $where | $expr |
+-------------+--------------------------------+
| $near | $geoWithin with $center |
+-------------+--------------------------------+
| $nearSphere | $geoWithin with $centerSphere |
+-------------+--------------------------------+Since
3.8
Counts the number of documents in the collection according to the given options.
Note: When migrating from count() to countDocuments() the following query operators must be replaced:
+-------------+--------------------------------+
| Operator | Replacement |
+=============+================================+
| $where | $expr |
+-------------+--------------------------------+
| $near | $geoWithin with $center |
+-------------+--------------------------------+
| $nearSphere | $geoWithin with $centerSphere |
+-------------+--------------------------------+Since
3.8
Parameters
the query filter
Counts the number of documents in the collection according to the given options.
Note: When migrating from count() to countDocuments() the following query operators must be replaced:
+-------------+--------------------------------+
| Operator | Replacement |
+=============+================================+
| $where | $expr |
+-------------+--------------------------------+
| $near | $geoWithin with $center |
+-------------+--------------------------------+
| $nearSphere | $geoWithin with $centerSphere |
+-------------+--------------------------------+Since
3.8
Parameters
the query filter
the options describing the count
Counts the number of documents in the collection.
Note: When migrating from count() to countDocuments() the following query operators must be replaced:
+-------------+--------------------------------+
| Operator | Replacement |
+=============+================================+
| $where | $expr |
+-------------+--------------------------------+
| $near | $geoWithin with $center |
+-------------+--------------------------------+
| $nearSphere | $geoWithin with $centerSphere |
+-------------+--------------------------------+Since
3.8
Parameters
the client session with which to associate this operation
Counts the number of documents in the collection according to the given options.
Note: When migrating from count() to countDocuments() the following query operators must be replaced:
+-------------+--------------------------------+
| Operator | Replacement |
+=============+================================+
| $where | $expr |
+-------------+--------------------------------+
| $near | $geoWithin with $center |
+-------------+--------------------------------+
| $nearSphere | $geoWithin with $centerSphere |
+-------------+--------------------------------+Since
3.8
Parameters
the client session with which to associate this operation
the query filter
Counts the number of documents in the collection according to the given options.
Note: When migrating from count() to countDocuments() the following query operators must be replaced:
+-------------+--------------------------------+
| Operator | Replacement |
+=============+================================+
| $where | $expr |
+-------------+--------------------------------+
| $near | $geoWithin with $center |
+-------------+--------------------------------+
| $nearSphere | $geoWithin with $centerSphere |
+-------------+--------------------------------+Since
3.8
Parameters
the client session with which to associate this operation
the query filter
the options describing the count