Skip to content

Commit 1fdc1eb

Browse files
jmd-mongoandf-mongodb
authored andcommitted
DOCS-14045 documents new explain fields
1 parent bf29c00 commit 1fdc1eb

File tree

4 files changed

+53
-41
lines changed

4 files changed

+53
-41
lines changed

source/includes/fact-explain-results-categories.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
|explain| operations can return information regarding:
22

3+
- ``explainVersion``, the output format version (for example, ``"1"``);
4+
5+
- ``command``, which details the command being explained;
6+
37
- :ref:`queryPlanner`, which details the plan selected by the
48
:doc:`query optimizer </core/query-plans>` and lists the rejected
59
plans;
610

711
- :ref:`executionStats`, which details the execution of the winning
8-
plan and the rejected plans; and
12+
plan and the rejected plans;
913

1014
- :ref:`serverInfo`, which provides information on the
11-
MongoDB instance.
15+
MongoDB instance; and
16+
17+
- ``serverParameters``, which details internal parameters.
1218

1319
The verbosity mode (i.e. ``queryPlanner``, ``executionStats``,
1420
``allPlansExecution``) determines whether the results include

source/reference/command/explain.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ Restrictions
144144

145145
.. include:: /includes/extracts/4.2-changes-agg-out-explain.rst
146146

147+
.. _explain-command-output:
148+
149+
Output
150+
------
151+
152+
.. include:: /includes/fact-explain-results-categories.rst
153+
154+
For details on the output, see :doc:`/reference/explain-results`.
155+
147156
Examples
148157
--------
149158

@@ -216,11 +225,3 @@ all considered plans for an :dbcommand:`update` command:
216225
}
217226
)
218227

219-
.. _explain-command-output:
220-
221-
Output
222-
------
223-
224-
.. include:: /includes/fact-explain-results-categories.rst
225-
226-
For details on the output, see :doc:`/reference/explain-results`.

source/reference/method/cursor.explain.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ verbosity mode.
114114

115115
See :method:`db.collection.explain()` for more information.
116116

117+
.. _explain-cursor-method-output:
118+
119+
Output
120+
------
121+
122+
.. include:: /includes/fact-explain-results-categories.rst
123+
124+
For details on the output, see :doc:`/reference/explain-results`.
125+
117126
Example
118127
-------
119128

@@ -128,11 +137,3 @@ specified :method:`db.collection.find()` operation:
128137
{ quantity: { $gt: 50 }, category: "apparel" }
129138
).explain("executionStats")
130139

131-
.. _explain-cursor-method-output:
132-
133-
Output
134-
------
135-
136-
.. include:: /includes/fact-explain-results-categories.rst
137-
138-
For details on the output, see :doc:`/reference/explain-results`.

source/reference/method/db.collection.explain.txt

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ The :method:`db.collection.explain()` method wraps the
160160

161161
.. include:: /includes/fact-explain-methods-differences.rst
162162

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
165166
the :method:`db.collection.aggregate()` method.
166167

167168
.. _explain-method-help:
@@ -176,10 +177,11 @@ To see the list of operations supported by
176177

177178
db.collection.explain().help()
178179

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:
183185

184186
.. code-block:: javascript
185187

@@ -188,6 +190,15 @@ supported by :method:`db.collection.explain().find()
188190
You can chain multiple modifiers to ``db.collection.explain().find()``.
189191
For an example, see :ref:`explain-find-modifiers`.
190192

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+
191202
.. _explain-method-examples:
192203

193204
Examples
@@ -250,9 +261,10 @@ all considered plans for the specified
250261
Explain ``find()`` with Modifiers
251262
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252263

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
256268
:method:`~cursor.sort()` and :method:`~cursor.hint()` query modifiers.
257269

258270
.. code-block:: javascript
@@ -271,22 +283,14 @@ shell:
271283
Iterate the ``explain().find()`` Return Cursor
272284
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
273285

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:
279292

280293
.. code-block:: javascript
281294

282295
var explainResult = db.products.explain().find( { category: "apparel" } ).next();
283296

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

Comments
 (0)