Skip to content

Commit 472bbc0

Browse files
committed
docs(aggregation): Fix deprecated count(), add missing comma in , clarify sample data note
1 parent 0a55e42 commit 472bbc0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

source/aggregation.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ Aggregation Pipelines
6363

6464
Aggregation Pipeline Example
6565
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66+
.. note::
67+
To run this example, load the ``sample_training`` dataset in MongoDB Atlas.
68+
See :ref:`how to load sample data <load-sample-data>`.
6669

6770
The following example pipeline uses documents from the :ref:`sample data
6871
<sample-data>` available in MongoDB Atlas, specifically the
@@ -140,7 +143,7 @@ The full pipeline resembles the following:
140143
$group : {
141144
_id : {
142145
"airline name": "$airline.name",
143-
}
146+
},
144147
count : {
145148
$sum: 1
146149
}
@@ -186,9 +189,10 @@ aggregation pipeline.
186189
- Returns an approximate count of the documents in a collection or
187190
a view.
188191

189-
* - :method:`db.collection.count()`
190-
- Returns a count of the number of documents in a collection or a
191-
view.
192+
* - :method:`db.collection.countDocuments()`
193+
- Returns an exact count of documents matching optional criteria.
194+
* - :method:`db.collection.estimatedDocumentCount()`
195+
- Returns a fast approximate count (no query filter support).
192196

193197
* - :method:`db.collection.distinct()`
194198
- Returns an array of documents that have distinct values for the

0 commit comments

Comments
 (0)