@@ -7,18 +7,18 @@ Count Documents
77.. note::
88 If you specify a callback method, ``countDocuments()`` and
99 ``estimatedDocumentCount()`` return nothing. If you do not specify one,
10- this method returns a
11- :mdn:`Promise <Web/JavaScript/Reference/Global_Objects/Promise>` that
12- resolves to the result object when it completes. For more information on
13- the result object type, see the
14- :node-api:`API documentation <Collection.html#~countCallback>` .
10+ this method returns a ``Promise`` that resolves to the result object
11+ when it completes. See our guide on :doc:`Promises and Callbacks
12+ </fundamentals/promises>` for more information, or the
13+ :node-api:`API documentation <Collection.html#~countCallback>` for
14+ information on the result object .
1515
16- The Node.js driver provides two methods for counting
17- documents in a collection:
16+ The Node.js driver provides two methods for counting documents in a
17+ collection:
1818
1919- :node-api:`collection.countDocuments()
2020 <Collection.html#countDocuments>` returns the number of documents in
21- the collection that match the specified query. If you specify a empty
21+ the collection that match the specified query. If you specify an empty
2222 query document, ``countDocuments()`` returns the total number of
2323 documents in the collection.
2424
@@ -53,3 +53,13 @@ collection with ``Canada`` in the ``countries`` field.
5353
5454.. literalinclude:: /code-snippets/usage-examples/count.js
5555 :language: javascript
56+
57+ If you run the sample code above, you should see output that resembles the
58+ following:
59+
60+ .. code-block:: none
61+
62+ Estimated number of documents in the movies collection: 23541
63+ Number of movies from Canada: 1349
64+
65+
0 commit comments