@@ -21,12 +21,16 @@ results. You can use aggregation operations to:
2121
2222To perform aggregation operations, you can use:
2323
24- - :ref:`Aggregation pipelines <aggregation-framework>`
24+ - :ref:`Aggregation pipelines <aggregation-framework>`, which are the
25+ preferred method for performing aggregations.
2526
2627- :ref:`Single purpose aggregation methods
27- <single-purpose-agg-operations>`
28+ <single-purpose-agg-methods>`, which are simple but lack the
29+ capabilities of an aggregation pipeline.
2830
29- - :ref:`Map-reduce functions <aggregation-map-reduce>`
31+ - :ref:`Map-reduce operations <aggregation-map-reduce>`, which are
32+ deprecated starting in MongoDB 5.0. Instead, use an aggregation
33+ pipeline.
3034
3135.. _aggregation-framework:
3236
@@ -40,50 +44,39 @@ Aggregation Pipeline Example
4044
4145.. include:: /includes/aggregation-pipeline-example.rst
4246
43- For a runnable example, see :ref:`Complete Aggregation Pipeline
44- Example <aggregation-pipeline-example>`.
47+ For runnable examples containing sample input documents, see
48+ :ref:`Complete Aggregation Pipeline Examples
49+ <aggregation-pipeline-examples>`.
4550
46- Aggregation Pipeline Stages and Operations
47- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51+ .. _single-purpose-agg-methods:
4852
49- The most basic pipeline stages provide *filters* that operate like
50- queries and *document transformations* that modify the form
51- of the output document.
53+ Single Purpose Aggregation Methods
54+ ----------------------------------
5255
53- Other pipeline operations provide tools for grouping and sorting
54- documents by specific field or fields as well as tools for aggregating
55- the contents of arrays, including arrays of documents. In addition,
56- pipeline stages can use :ref:`operators
57- <aggregation-expression-operators>` for tasks such as calculating the
58- average or concatenating a string.
56+ You can use the following single purpose aggregation methods to
57+ aggregate documents from a single collection:
5958
60- The pipeline provides efficient data aggregation using native
61- operations within MongoDB, and is the preferred method for data
62- aggregation in MongoDB.
59+ .. list-table::
60+ :header-rows: 1
61+ :widths: 50 50
62+
63+ * - Method
64+ - Description
6365
64- The aggregation pipeline can operate on a
65- :doc:`sharded collection </sharding>`.
66+ * - :method:`db.collection.estimatedDocumentCount()`
67+ - Returns an approximate count of the documents in a collection or
68+ a view.
6669
67- The aggregation pipeline can use indexes to improve its performance
68- during some of its stages. In addition, the aggregation pipeline has an
69- internal optimization phase. See
70- :ref:`aggregation-pipeline-operators-and-performance` and
71- :doc:`/core/aggregation-pipeline-optimization` for details.
70+ * - :method:`db.collection.count()`
71+ - Returns a count of the number of documents in a collection or a
72+ view.
7273
73- .. _single-purpose-agg-operations:
74+ * - :method:`db.collection.distinct()`
75+ - Returns an array of documents that have distinct values for the
76+ specified field.
7477
75- Single Purpose Aggregation Operations
76- -------------------------------------
77-
78- MongoDB also provides :method:`db.collection.estimatedDocumentCount()`,
79- :method:`db.collection.count()` and :method:`db.collection.distinct()`.
80-
81- All of these operations aggregate documents from a single collection.
82- While these operations provide simple access to common aggregation
83- processes, they lack the flexibility and capabilities of an aggregation
84- pipeline.
85-
86- .. include:: /images/distinct.rst
78+ The single purpose aggregation methods are simple but lack the
79+ capabilities of an :ref:`aggregation pipeline <aggregation-framework>`.
8780
8881.. _aggregation-map-reduce:
8982
@@ -92,21 +85,22 @@ Map-Reduce
9285
9386.. include:: /includes/fact-use-aggregation-not-map-reduce.rst
9487
95- Additional Features and Behaviors
96- ---------------------------------
97-
98- For a feature comparison of the aggregation pipeline,
99- map-reduce, and the special group functionality, see
88+ For a feature comparison of aggregation pipelines and map-reduce, see
10089:doc:`/reference/aggregation-commands-comparison`.
10190
10291Learn More
10392----------
10493
105- Practical MongoDB Aggregations E-Book
106- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94+ To learn more about aggregations, see:
95+
96+ - :ref:`aggregation-pipeline`
97+
98+ - :ref:`aggregation-expression-operators`
99+
100+ - :ref:`aggregation-pipeline-operator-reference`
107101
108- For more information on aggregations, read the `Practical MongoDB
109- Aggregations <https://www.practical-mongodb-aggregations.com>`__ e-book.
102+ - `Practical MongoDB Aggregations
103+ <https://www.practical-mongodb-aggregations.com>`_
110104
111105
112106.. toctree::
0 commit comments