@@ -27,10 +27,13 @@ In this guide, you can learn how to use the MongoDB Node.js Driver to perform
2727**aggregation operations**.
2828
2929Aggregation operations process data in your MongoDB collections and return
30- reduced and summarized results. The MongoDB Aggregation framework is modeled on the
30+ computed results. The MongoDB Aggregation framework is modeled on the
3131concept of data processing pipelines. Documents enter a pipeline comprised of one or
3232more stages, and this pipeline transforms the documents into an aggregated result.
3333
34+ To learn more about the aggregation stages supported by the Node.js Driver, see :ref:`Aggregation Stages <>`.
35+ .. todo-- add link here
36+
3437Analogy
3538~~~~~~~
3639
@@ -89,43 +92,40 @@ Consider the following :manual:`limitations </core/aggregation-pipeline-limits/>
8992 property of the ``AggregateOptions`` object that you pass to the
9093 ``Aggregate()`` method.
9194
92- - The :manual:`$graphLookup </reference/operator/aggregation/graphLookup/>`
93- stage has a strict memory limit of 100 megabytes and will ignore the
94- ``AllowDiskUse`` property.
95-
95+ ..
9696Aggregation Example
9797-------------------
98-
98+ ..
9999To perform an aggregation, pass a list of aggregation stages to the
100100``collection.aggregate()`` method.
101-
101+ ..
102102.. note::
103-
103+ ..
104104 This example uses the ``sample_restaurants.restaurants`` collection
105105 from the :atlas:`Atlas sample datasets </sample-data>`. To learn how to create a
106106 free MongoDB Atlas cluster and load the sample datasets, see the :ref:`Get Started <node-get-started>` guide.
107-
107+ ..
108108The following code example produces a count of the number of bakeries in each borough
109109of New York City. To do so, the aggregation pipeline uses the following aggregation stages:
110-
110+ ..
111111- A :manual:`$match </reference/operator/aggregation/match/>` stage to filter
112112 for documents whose ``cuisine`` field contains the element ``Bakery``.
113-
113+ ..
114114- A :manual:`$group </reference/operator/aggregation/group/>` stage to group the
115115 matching documents by the ``borough`` field, accumulating a count of documents
116116 for each distinct value in the ``borough`` field.
117-
117+ ..
118118.. literalinclude:: /code-snippets/aggregation/agg.js
119119 :start-after: begin aggregation
120120 :end-before: end aggregation
121121 :language: javascript
122122 :dedent:
123-
123+ ..
124124This example produces the following output:
125-
125+ ..
126126.. code-block:: json
127127 :copyable: false
128-
128+ ..
129129 { _id = 'Bronx', count = 71 }
130130 { _id = 'Brooklyn', count = 173 }
131131 { _id = 'Staten Island', count = 20 }
@@ -136,28 +136,27 @@ This example produces the following output:
136136Additional information
137137----------------------
138138
139- MongoDB Server Manual
140- ~~~~~~~~~~~~~~~~~~~~~
141-
142139To view a full list of expression operators, see
143140:manual:`Aggregation Operators </reference/operator/aggregation/>`.
144141
142+ ..
145143To learn more about assembling an aggregation pipeline and view examples, see
146144:manual:`Aggregation Pipeline </core/aggregation-pipeline/>`.
147-
145+ ..
148146To learn more about creating pipeline stages and view examples, see
149147:manual:`Aggregation Stages </reference/operator/aggregation-pipeline/>`.
150148
151149To learn about explaining MongoDB aggregation operations, see
152150:manual:`Explain Results </reference/explain-results/>` and
153151:manual:`Query Plans </core/query-plans/>`.
154152
153+ ..
155154API Documentation
156155~~~~~~~~~~~~~~~~~
157-
156+ ..
158157For more information about the aggregation operations discussed in this guide, see the
159158following API documentation:
160-
159+ ..
161160- `Collection() <https://mongodb.github.io/node-mongodb-native/6.17/classes/Collection.html>`__
162161- `aggregate() <https://mongodb.github.io/node-mongodb-native/6.17/classes/Collection.html#aggregate>`__
163162- `AggregateOptions <https://mongodb.github.io/node-mongodb-native/6.17/interfaces/AggregateOptions.html>`__
0 commit comments