@@ -160,8 +160,9 @@ The :method:`db.collection.explain()` method wraps the
160
160
161
161
.. include:: /includes/fact-explain-methods-differences.rst
162
162
163
- :method:`db.collection.explain().aggregate() <db.collection.explain()>` is equivalent to passing
164
- the :ref:`explain <example-aggregate-method-explain-option>` option to
163
+ :method:`db.collection.explain().aggregate() <db.collection.explain()>`
164
+ is equivalent to passing the
165
+ :ref:`explain <example-aggregate-method-explain-option>` option to
165
166
the :method:`db.collection.aggregate()` method.
166
167
167
168
.. _explain-method-help:
@@ -176,10 +177,11 @@ To see the list of operations supported by
176
177
177
178
db.collection.explain().help()
178
179
179
- :method:`db.collection.explain().find() <db.collection.explain()>` returns a cursor, which allows
180
- for the chaining of query modifiers. To see the list of query modifiers
181
- supported by :method:`db.collection.explain().find()
182
- <db.collection.explain()>` as well as cursor-related methods, run:
180
+ :method:`db.collection.explain().find() <db.collection.explain()>`
181
+ returns a cursor, which allows for the chaining of query modifiers.
182
+ To see the list of query modifiers supported by
183
+ :method:`db.collection.explain().find() <db.collection.explain()>` as
184
+ well as cursor-related methods, run:
183
185
184
186
.. code-block:: javascript
185
187
@@ -188,6 +190,15 @@ supported by :method:`db.collection.explain().find()
188
190
You can chain multiple modifiers to ``db.collection.explain().find()``.
189
191
For an example, see :ref:`explain-find-modifiers`.
190
192
193
+ .. _explain-collection-method-output:
194
+
195
+ Output
196
+ ------
197
+
198
+ .. include:: /includes/fact-explain-results-categories.rst
199
+
200
+ For details on the output, see :doc:`/reference/explain-results`.
201
+
191
202
.. _explain-method-examples:
192
203
193
204
Examples
@@ -250,9 +261,10 @@ all considered plans for the specified
250
261
Explain ``find()`` with Modifiers
251
262
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252
263
253
- :method:`db.collection.explain().find() <db.collection.explain()>` construct allows for the
254
- chaining of query modifiers. For example, the following operation
255
- provides information on the :method:`~db.collection.find()` method with
264
+ :method:`db.collection.explain().find() <db.collection.explain()>`
265
+ construct allows for the chaining of query modifiers. For example, the
266
+ following operation provides information on the
267
+ :method:`~db.collection.find()` method with
256
268
:method:`~cursor.sort()` and :method:`~cursor.hint()` query modifiers.
257
269
258
270
.. code-block:: javascript
@@ -271,22 +283,14 @@ shell:
271
283
Iterate the ``explain().find()`` Return Cursor
272
284
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
273
285
274
- :method:`db.collection.explain().find() <db.collection.explain()>` returns a cursor to the
275
- explain results. If run interactively in the :binary:`~bin.mongo` shell,
276
- the :binary:`~bin.mongo` shell automatically iterates the cursor using the
277
- ``.next()`` method. For scripts, however, you must explicitly call
278
- ``.next()`` (or its alias ``.finish()``) to return the results:
286
+ :method:`db.collection.explain().find() <db.collection.explain()>`
287
+ returns a cursor to the explain results. If run interactively in the
288
+ :binary:`~bin.mongo` shell, the :binary:`~bin.mongo` shell automatically
289
+ iterates the cursor using the ``.next()`` method. For scripts, however,
290
+ you must explicitly call ``.next()`` (or its alias ``.finish()``) to
291
+ return the results:
279
292
280
293
.. code-block:: javascript
281
294
282
295
var explainResult = db.products.explain().find( { category: "apparel" } ).next();
283
296
284
- .. _explain-collection-method-output:
285
-
286
- Output
287
- ------
288
-
289
- .. include:: /includes/fact-explain-results-categories.rst
290
-
291
- For details on the output, see :doc:`/reference/explain-results`.
292
-
0 commit comments