@@ -94,8 +94,8 @@ Aggregation Example
94
94
free MongoDB Atlas cluster and load the sample datasets, see the :atlas:`Get Started with Atlas
95
95
</getting-started>` guide.
96
96
97
- To perform an aggregation, pass an array containing the aggregation pipeline
98
- stages to the ``MongoDB\Collection::aggregate()`` method.
97
+ To perform an aggregation, pass an array containing the pipeline stages to
98
+ the ``MongoDB\Collection::aggregate()`` method.
99
99
100
100
The following code example produces a count of the number of bakeries in each borough
101
101
of New York. To do so, it uses an aggregation pipeline that contains the following stages:
@@ -136,13 +136,12 @@ An execution plan is a potential way in which MongoDB can complete an operation.
136
136
When you instruct MongoDB to explain an operation, it returns both the
137
137
plan MongoDB executed and any rejected execution plans.
138
138
139
- To explain an aggregation operation, run the ``explain`` database command by passing
140
- the command information to the ``MongoDB\Database::command()`` method. You must specify the
141
- ``aggregate``, ``pipeline``, and ``cursor`` fields in the ``explain`` command document
142
- to explain the aggregation.
139
+ To explain an aggregation operation, construct a ``MongoDB\Operation\Aggregate`` object
140
+ and pass the database, collection, and pipeline stages as parameters. Then, pass the
141
+ ``MongoDB\Operation\Aggregate`` object to the ``MongoDB\Collection::explain()`` method.
143
142
144
- The following example instructs MongoDB to explain the aggregation operation from the
145
- preceding :ref:`php-aggregation-example`:
143
+ The following example instructs MongoDB to explain the aggregation operation
144
+ from the preceding :ref:`php-aggregation-example`:
146
145
147
146
.. io-code-block::
148
147
:copyable:
@@ -162,7 +161,6 @@ preceding :ref:`php-aggregation-example`:
162
161
"maxIndexedAndSolutionsReached":false,"maxScansToExplodeReached":false,"winningPlan":{
163
162
... }
164
163
165
-
166
164
Additional Information
167
165
----------------------
168
166
0 commit comments