Skip to content

Commit 051f345

Browse files
committed
Merge pull request #735
* phplib-434: Fix typo in index documentation PHPLIB-434: Add note about performance of countDocuments
2 parents 632cd8b + 89721f0 commit 051f345

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

docs/reference/method/MongoDBCollection-countDocuments.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ obtain the result. If a ``filter`` parameter is given, this is converted into
5252
a ``$match`` pipeline operator. Optional ``$skip`` and ``$limit`` stages are
5353
added between ``$match`` and ``group`` if present in the options.
5454

55+
.. note::
56+
57+
This method counts documents on the server side. To obtain an approximate
58+
total number of documents without filters, the
59+
:phpmethod:`MongoDB\\Collection::estimatedDocumentCount()` method can be
60+
used. This method estimates the number of documents based on collection
61+
metadata, thus sacrificing accuracy for performance.
62+
5563
Since this method uses an aggregation pipeline, some query operators accepted
5664
within a :phpmethod:`MongoDB\\Collection::count()` ``filter`` cannot be used.
5765
Consider the following alternatives to these restricted operators:

docs/reference/method/MongoDBCollection-createIndex.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The output would then resemble::
7373
Create a Partial Index
7474
~~~~~~~~~~~~~~~~~~~~~~
7575

76-
The following example adds a :manual:`partial index </core/index-parital>` on
76+
The following example adds a :manual:`partial index </core/index-partial>` on
7777
the ``borough`` field in the ``restaurants`` collection in the ``test``
7878
database. The partial index indexes only documents where the ``borough`` field
7979
exists.

0 commit comments

Comments
 (0)