@@ -70,25 +70,25 @@ Limitations
70
70
Consider the following limitations when performing aggregation operations:
71
71
72
72
- Returned documents cannot violate the
73
- :manual:`BSON document size limit </reference/limits/#mongodb-limit-BSON-Document-Size>`
74
- of 16 megabytes.
73
+ :manual:`BSON document size limit </reference/limits/#mongodb-limit-BSON-Document-Size>`
74
+ of 16 megabytes.
75
75
- Pipeline stages have a memory limit of 100 megabytes by default. You can exceed this
76
- limit by creating an options array that sets the ``allowDiskUse`` option to ``true``
77
- and passing the array to the ``MongoDB\Collection::aggregate()`` method.
76
+ limit by creating an options array that sets the ``allowDiskUse`` option to ``true``
77
+ and passing the array to the ``MongoDB\Collection::aggregate()`` method.
78
78
79
- .. important:: $graphLookup Exception
80
-
81
- The :manual:`$graphLookup
82
- </reference/operator/aggregation/graphLookup/>` stage has a strict
83
- memory limit of 100 megabytes and ignores the ``allowDiskUse`` option.
79
+ .. important:: $graphLookup Exception
80
+
81
+ The :manual:`$graphLookup
82
+ </reference/operator/aggregation/graphLookup/>` stage has a strict
83
+ memory limit of 100 megabytes and ignores the ``allowDiskUse`` option.
84
84
85
85
.. _php-aggregation-example:
86
86
87
87
Aggregation Example
88
88
-------------------
89
89
90
90
.. note::
91
-
91
+
92
92
The examples in this guide use the ``restaurants`` collection in the ``sample_restaurants``
93
93
database from the :atlas:`Atlas sample datasets </sample-data>`. To learn how to create a
94
94
free MongoDB Atlas cluster and load the sample datasets, see the :atlas:`Get Started with Atlas
@@ -101,30 +101,30 @@ The following code example produces a count of the number of bakeries in each bo
101
101
of New York. To do so, it uses an aggregation pipeline that contains the following stages:
102
102
103
103
- :manual:`$match </reference/operator/aggregation/match/>` stage to filter for documents
104
- in which the ``cuisine`` field contains the value ``'Bakery'``
104
+ in which the ``cuisine`` field contains the value ``'Bakery'``
105
105
106
106
- :manual:`$group </reference/operator/aggregation/group/>` stage to group the matching
107
- documents by the ``borough`` field, accumulating a count of documents for each distinct
108
- value
107
+ documents by the ``borough`` field, accumulating a count of documents for each distinct
108
+ value
109
109
110
110
.. io-code-block::
111
111
:copyable:
112
112
113
113
.. input:: /includes/aggregation/aggregation.php
114
- :start-after: start-match-group
115
- :end-before: end-match-group
116
- :language: php
117
- :dedent:
114
+ :start-after: start-match-group
115
+ :end-before: end-match-group
116
+ :language: php
117
+ :dedent:
118
118
119
119
.. output::
120
- :visible: false
120
+ :visible: false
121
121
122
- {"_id":"Brooklyn","count":173}
123
- {"_id":"Queens","count":204}
124
- {"_id":"Bronx","count":71}
125
- {"_id":"Staten Island","count":20}
126
- {"_id":"Missing","count":2}
127
- {"_id":"Manhattan","count":221}
122
+ {"_id":"Brooklyn","count":173}
123
+ {"_id":"Queens","count":204}
124
+ {"_id":"Bronx","count":71}
125
+ {"_id":"Staten Island","count":20}
126
+ {"_id":"Missing","count":2}
127
+ {"_id":"Manhattan","count":221}
128
128
129
129
Explain an Aggregation
130
130
~~~~~~~~~~~~~~~~~~~~~~
@@ -147,19 +147,19 @@ from the preceding :ref:`php-aggregation-example`:
147
147
:copyable:
148
148
149
149
.. input:: /includes/aggregation/aggregation.php
150
- :start-after: start-explain
151
- :end-before: end-explain
152
- :language: php
153
- :dedent:
150
+ :start-after: start-explain
151
+ :end-before: end-explain
152
+ :language: php
153
+ :dedent:
154
154
155
155
.. output::
156
- :visible: false
156
+ :visible: false
157
157
158
- {"explainVersion":"2","queryPlanner":{"namespace":"sample_restaurants.restaurants",
159
- "indexFilterSet":false,"parsedQuery":{"cuisine":{"$eq":"Bakery"}},"queryHash":"865F14C3",
160
- "planCacheKey":"D56D6F10","optimizedPipeline":true,"maxIndexedOrSolutionsReached":false,
161
- "maxIndexedAndSolutionsReached":false,"maxScansToExplodeReached":false,"winningPlan":{
162
- ... }
158
+ {"explainVersion":"2","queryPlanner":{"namespace":"sample_restaurants.restaurants",
159
+ "indexFilterSet":false,"parsedQuery":{"cuisine":{"$eq":"Bakery"}},"queryHash":"865F14C3",
160
+ "planCacheKey":"D56D6F10","optimizedPipeline":true,"maxIndexedOrSolutionsReached":false,
161
+ "maxIndexedAndSolutionsReached":false,"maxScansToExplodeReached":false,"winningPlan":{
162
+ ... }
163
163
164
164
Additional Information
165
165
----------------------
0 commit comments