Skip to content

Commit f8d38eb

Browse files
committed
trivial: additional updates to explain
1 parent 5f4829a commit f8d38eb

File tree

5 files changed

+39
-38
lines changed

5 files changed

+39
-38
lines changed

source/includes/apiargs-dbcommand-explain-field.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
arg_name: field
22
description: |
33
A document specifying the command for which to return the execution
4-
information. For details on the specific command document, see :dbcommand:`count`,
4+
information. For details on the specific command document, see :dbcommand:`aggregate`, :dbcommand:`count`,
55
:dbcommand:`distinct`, :dbcommand:`group`, :dbcommand:`find`,
66
:dbcommand:`findAndModify`, :dbcommand:`delete`, and :dbcommand:`update`.
77
interface: dbcommand
@@ -17,14 +17,15 @@ description: |
1717
The mode affects the behavior of :dbcommand:`explain` and determines
1818
the amount of information to return.
1919
20-
Possible modes are: :ref:`"queryPlanner" <explain-queryPlanner>`,
21-
:ref:`"executionStats" <explain-executionStats>`, and
22-
:ref:`"allPlansExecution" <explain-allPlansExecution>`. For more
23-
information on the modes, see :ref:`explain behavior
24-
<explain-command-behavior>`.
20+
The possible modes are:
21+
22+
- ``"queryPlanner"``
23+
- ``"executionStats"``
24+
- ``"allPlansExecution"`` (Default)
2525
26-
By default, :dbcommand:`explain` runs in :ref:`"allPlansExecution"
27-
<explain-allPlansExecution>` mode.
26+
For more information on the modes, see :ref:`explain behavior
27+
<explain-command-behavior>`.
28+
2829
interface: dbcommand
2930
name: verbosity
3031
operation: explain

source/includes/apiargs-method-db.collection.explain-param.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ arg_name: param
22
description: |
33
Specifies the verbosity mode for the explain output. The mode affects
44
the behavior of ``explain()`` and determines the amount of information
5-
to return. The possible modes are: ``"queryPlanner"``,
6-
``"executionStats"``, and ``"allPlansExecution"``.
7-
8-
Default mode is ``"queryPlanner"``.
5+
to return. The possible modes are:
6+
7+
- ``"queryPlanner"`` (Default)
8+
- ``"executionStats"``
9+
- ``"allPlansExecution"``
910
1011
For backwards compatibility with earlier versions of
1112
:method:`cursor.explain()`, MongoDB interprets ``true`` as

source/reference/command/explain.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ Definition
1919

2020

2121
The :dbcommand:`explain` command provides information on the
22-
execution of the following commands: :dbcommand:`count`, :dbcommand:`distinct`,
23-
:dbcommand:`group`, :dbcommand:`find`, :dbcommand:`findAndModify`,
24-
:dbcommand:`delete`, and :dbcommand:`update`.
22+
execution of the following commands: :dbcommand:`aggregate`,
23+
:dbcommand:`count`, :dbcommand:`distinct`, :dbcommand:`group`,
24+
:dbcommand:`find`, :dbcommand:`findAndModify`, :dbcommand:`delete`,
25+
and :dbcommand:`update`.
2526

2627
Although MongoDB provides the :dbcommand:`explain` command, the
2728
preferred method for running :dbcommand:`explain` is to use the

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

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -151,35 +151,35 @@ The operation returns a cursor with the following documents:
151151
Return Information on Aggregation Pipeline Operation
152152
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153153

154-
The following aggregation operation sets the option ``explain`` to
155-
``true`` to return information about the aggregation operation.
154+
The following example uses :method:`db.collection.explain()` to view
155+
detailed information regarding the execution plan of the aggregation
156+
pipeline.
156157

157158
.. code-block:: javascript
158159

159-
db.orders.aggregate(
160-
[
161-
{ $match: { status: "A" } },
162-
{ $group: { _id: "$cust_id", total: { $sum: "$amount" } } },
163-
{ $sort: { total: -1 } }
164-
],
165-
{
166-
explain: true
167-
}
168-
)
160+
db.orders.explain().aggregate([
161+
{ $match: { status: "A" } },
162+
{ $group: { _id: "$cust_id", total: { $sum: "$amount" } } },
163+
{ $sort: { total: -1 } }
164+
])
169165

170-
The operation returns a cursor with the document that contains detailed
171-
information regarding the processing of the aggregation pipeline. For
172-
example, the document may show, among other details, which index, if
173-
any, the operation used. [#agg-index-filters]_ If the ``orders`` collection
174-
is a sharded collection, the document would also show the division of
175-
labor between the shards and the merge operation, and for targeted
176-
queries, the targeted shards.
166+
The operation returns a document that details the processing of the
167+
aggregation pipeline. For example, the document may show, among other
168+
details, which index, if any, the operation used. [#agg-index-filters]_
169+
If the ``orders`` collection is a sharded collection, the document
170+
would also show the division of labor between the shards and the merge
171+
operation, and for targeted queries, the targeted shards.
177172

178173
.. note:: The intended readers of the ``explain`` output document are humans, and
179174
not machines, and the output format is subject to change between
180175
releases.
181176

182-
.. include:: /includes/note-mongo-shell-automatically-iterates-cursor.rst
177+
You can view more verbose explain output by passing the
178+
``executionStats`` or ``allPlansExecution`` explain modes to the
179+
:method:`db.collection.explain()` method.
180+
181+
.. [#agg-index-filters] :ref:`index-filters` can affect the choice of index
182+
used. See :ref:`index-filters` for details.
183183

184184
.. _example-aggregate-method-external-sort:
185185

@@ -328,9 +328,6 @@ majority of the nodes.
328328
{ readConcern: { level: "majority" } }
329329
)
330330

331-
.. [#agg-index-filters] :ref:`index-filters` can affect the choice of index
332-
used. See :ref:`index-filters` for details.
333-
334331
Specify a Comment
335332
~~~~~~~~~~~~~~~~~
336333

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Description
2828
* - - :method:`~db.collection.aggregate()`
2929
- :method:`~db.collection.count()`
3030
- :method:`~db.collection.find()`
31+
- :method:`~db.collection.group()`
3132
- :method:`~db.collection.remove()`
3233
- :method:`~db.collection.update()`
3334

0 commit comments

Comments
 (0)