Skip to content

Commit 5b8641e

Browse files
committed
Merge pull request #552
2 parents bfc80b8 + 2bb06ca commit 5b8641e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/reference/method/MongoDBCollection-countDocuments.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,26 @@ Behavior
5151

5252
Internally, this method uses the ``$group`` aggregation pipeline operator to
5353
obtain the result. If a ``filter`` parameter is given, this is converted into
54-
a ``$match`` pipeline operator. Optional ``skip`` and ``limit`` stages are
54+
a ``$match`` pipeline operator. Optional ``$skip`` and ``$limit`` stages are
5555
added between ``$match`` and ``group`` if present in the options.
5656

57+
Since this method uses an aggregation pipeline, some query operators accepted
58+
within a :phpmethod:`MongoDB\\Collection::count()` ``filter`` cannot be used.
59+
Consider the following alternatives to these restricted operators:
60+
61+
.. list-table::
62+
:header-rows: 1
63+
64+
* - Restricted
65+
- Alternative Syntax
66+
67+
* - :query:`$near`
68+
- :query:`$geoWithin` with :query:`$center`
69+
70+
* - :query:`$nearSphere`
71+
- :query:`$geoWithin` with :query:`$centerSphere`
72+
73+
* - :query:`$where`
74+
- :query:`$expr` (requires MongoDB 3.6+)
75+
5776
.. todo: add output and examples

0 commit comments

Comments
 (0)