Skip to content

Commit

Permalink
Merge pull request #735
Browse files Browse the repository at this point in the history
* phplib-434:
  Fix typo in index documentation
  PHPLIB-434: Add note about performance of countDocuments
  • Loading branch information
alcaeus committed Apr 7, 2020
2 parents 632cd8b + 89721f0 commit 051f345
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/reference/method/MongoDBCollection-countDocuments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ obtain the result. If a ``filter`` parameter is given, this is converted into
a ``$match`` pipeline operator. Optional ``$skip`` and ``$limit`` stages are
added between ``$match`` and ``group`` if present in the options.

.. note::

This method counts documents on the server side. To obtain an approximate
total number of documents without filters, the
:phpmethod:`MongoDB\\Collection::estimatedDocumentCount()` method can be
used. This method estimates the number of documents based on collection
metadata, thus sacrificing accuracy for performance.

Since this method uses an aggregation pipeline, some query operators accepted
within a :phpmethod:`MongoDB\\Collection::count()` ``filter`` cannot be used.
Consider the following alternatives to these restricted operators:
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBCollection-createIndex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The output would then resemble::
Create a Partial Index
~~~~~~~~~~~~~~~~~~~~~~

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

0 comments on commit 051f345

Please sign in to comment.