From 472bbc0ab35fd76125439b2d2c11bdec7c9b50cb Mon Sep 17 00:00:00 2001 From: ayaarragab Date: Tue, 6 May 2025 01:28:46 +0300 Subject: [PATCH] docs(aggregation): Fix deprecated count(), add missing comma in , clarify sample data note --- source/aggregation.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/aggregation.txt b/source/aggregation.txt index c6e859d5d02..35b976d634e 100644 --- a/source/aggregation.txt +++ b/source/aggregation.txt @@ -63,6 +63,9 @@ Aggregation Pipelines Aggregation Pipeline Example ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. note:: + To run this example, load the ``sample_training`` dataset in MongoDB Atlas. + See :ref:`how to load sample data `. The following example pipeline uses documents from the :ref:`sample data ` available in MongoDB Atlas, specifically the @@ -140,7 +143,7 @@ The full pipeline resembles the following: $group : { _id : { "airline name": "$airline.name", - } + }, count : { $sum: 1 } @@ -186,9 +189,10 @@ aggregation pipeline. - Returns an approximate count of the documents in a collection or a view. - * - :method:`db.collection.count()` - - Returns a count of the number of documents in a collection or a - view. + * - :method:`db.collection.countDocuments()` + - Returns an exact count of documents matching optional criteria. + * - :method:`db.collection.estimatedDocumentCount()` + - Returns a fast approximate count (no query filter support). * - :method:`db.collection.distinct()` - Returns an array of documents that have distinct values for the