Skip to content

Commit 51713c2

Browse files
authored
Edited aggregation pipeline doc, added that you can adjust stage width (#345)
* Edited aggregation pipeline doc, added that you can adjust stage width * copy review
1 parent 058f2f2 commit 51713c2

File tree

2 files changed

+98
-85
lines changed

2 files changed

+98
-85
lines changed

source/aggregation-pipeline-builder.txt

Lines changed: 91 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,65 +14,59 @@ Aggregation Pipeline Builder
1414

1515
*New in version 1.14.0*
1616

17-
The Aggregation Pipeline Builder in |compass| provides the ability to
18-
create :manual:`aggregation pipelines </core/aggregation-pipeline/>` to
19-
process data. With aggregation pipelines, documents in a collection
20-
or view pass through multiple stages where they are processed into a
21-
set of aggregated results. The particular stages and results can be
22-
modified depending on your application's needs.
17+
Create :manual:`aggregation pipelines </core/aggregation-pipeline/>` to
18+
process data. In aggregation pipelines, documents in a collection
19+
or view pass through stages where |compass| processes them into a
20+
set of aggregated results. You can change the stages and results to
21+
suit your needs.
2322

24-
To access the aggregation pipeline builder, navigate to the
25-
:doc:`collection or view </collections>` for which you wish to create an
26-
aggregation pipeline and click the :guilabel:`Aggregations` tab. You
27-
are presented with a blank aggregation pipeline. The
28-
:guilabel:`Preview of Documents in the Collection` section of the
29-
:guilabel:`Aggregations` view displays 20 documents sampled from the
30-
current collection.
23+
To start building an aggregation pipeline for a :doc:`collection or view
24+
</collections>`, choose the collection and click the
25+
:guilabel:`Aggregations` tab.
26+
A blank aggregation pipeline displays. The :guilabel:`Preview of
27+
Documents in the Collection` section of the :guilabel:`Aggregations`
28+
view displays 20 documents sampled from the current collection.
3129

32-
To populate the Aggregation Pipeline Builder, you can either:
30+
You can:
3331

34-
- :ref:`Create a new Aggregation Pipeline in the UI <create-agg-pipeline>`,
32+
- :ref:`Create a new aggregation pipeline <create-agg-pipeline>`
3533

36-
- :ref:`Open a saved pipeline <open-saved-pipeline>`, or
34+
- :ref:`Save a pipeline <save-agg-pipeline>`
3735

38-
- :ref:`Import a Pipeline from Plain Text <compass-import-pipeline>`
36+
- :ref:`Open a saved pipeline <open-saved-pipeline>`
3937

40-
.. _create-agg-pipeline:
38+
- :ref:`Set the documents limit or auto preview documents <use-sample-mode-or-auto-preview>`
4139

42-
Create an Aggregation Pipeline
43-
------------------------------
40+
- :ref:`View or change pipeline settings <change-pipeline-settings>`
4441

45-
.. include:: /includes/steps/create-agg-pipeline.rst
42+
- :ref:`Specify custom collation <pipeline-custom-collation>`
4643

47-
.. _pipeline-custom-collation:
44+
- :ref:`Create a view from pipeline results <create-a-view>`
4845

49-
Specify Custom Collation
50-
~~~~~~~~~~~~~~~~~~~~~~~~
46+
- :ref:`Import a pipeline from plain text <compass-import-pipeline>`
5147

52-
Use :manual:`custom collation </reference/collation/>` to specify
53-
language-specific rules for string comparison, such as rules for
54-
letter case and accent marks.
48+
- :ref:`Export a pipeline to Java, Node, C#, and Python 3 <compass-export-pipeline>`
5549

56-
To specify a custom collation:
50+
Limitations
51+
-----------
5752

58-
#. Click the :guilabel:`Collation` button at the top of the pipeline
59-
builder.
53+
The :pipeline:`$out` stage is not available if you are connected to a
54+
`Data Lake <https://www.mongodb.com/atlas/data-lake>`__.
6055

61-
#. Enter your collation document.
56+
.. _create-agg-pipeline:
6257

63-
Limitations
64-
~~~~~~~~~~~
58+
Create an Aggregation Pipeline
59+
------------------------------
6560

66-
The :pipeline:`$out` stage is not available if you are connected to a
67-
`Data Lake <https://www.mongodb.com/atlas/data-lake>`__.
61+
.. include:: /includes/steps/create-agg-pipeline.rst
6862

6963
.. _save-agg-pipeline:
7064

7165
Save a Pipeline
7266
---------------
7367

74-
You can save a pipeline so that you can access it later. If you
75-
load a saved pipeline, you can modify it without
68+
You can save a pipeline so that you can find it later. If you
69+
load a saved pipeline, you can change it without
7670
changing the original saved copy. You can also create a :ref:`view
7771
<view-details>` from your pipeline results.
7872

@@ -85,20 +79,6 @@ To save your pipeline:
8579

8680
#. Click :guilabel:`Save`.
8781

88-
.. _create-a-view:
89-
90-
Create a View from Pipeline Results
91-
-----------------------------------
92-
93-
.. note::
94-
95-
Creating a view from pipeline results does not save the pipeline
96-
itself.
97-
98-
To create a view from your pipeline results:
99-
100-
.. include:: /includes/fact-create-view-from-pipeline.rst
101-
10282
.. _open-saved-pipeline:
10383

10484
Open a Saved Pipeline
@@ -111,11 +91,13 @@ Open a Saved Pipeline
11191

11292
#. In the modal, click :guilabel:`Open Pipeline`.
11393

114-
Pipeline Options
115-
----------------
94+
.. _use-sample-mode-or-auto-preview:
11695

117-
The toggles at the top of the pipeline builder control the
118-
following options:
96+
Set the Documents Limit or Auto Preview Documents
97+
-------------------------------------------------
98+
99+
Use the toggles at the top of the pipeline builder to set the
100+
limit on the number of sampled documents or to enable auto preview.
119101

120102
.. list-table::
121103
:header-rows: 1
@@ -134,15 +116,17 @@ following options:
134116
preview documents pane to reflect the results of each active
135117
stage as the pipeline progresses.
136118

137-
Pipeline Settings
138-
~~~~~~~~~~~~~~~~~
119+
.. _change-pipeline-settings:
120+
121+
View or Change Pipeline Settings
122+
--------------------------------
139123

140-
To view and modify pipeline settings:
124+
To view and change pipeline settings:
141125

142-
1. Click the gear icon at the top right of the pipeline builder to
126+
1. Click the gear icon at the upper right of the pipeline builder to
143127
open the :guilabel:`Settings` panel.
144128

145-
#. Modify the pipeline settings. The following settings can be modified:
129+
#. Change any of the following pipeline settings.
146130

147131
.. list-table::
148132
:header-rows: 1
@@ -159,29 +143,60 @@ To view and modify pipeline settings:
159143
- 20
160144
* - .. data:: Max Time
161145
- Cumulative time limit in milliseconds for processing
162-
the pipeline. Use this option to prevent long hang times.
146+
the pipeline. Use this option to limit the waiting time if
147+
the pipeline stops responding.
163148
- 5000
164149
* - .. data:: Limit
165-
- When :guilabel:`Sample Mode` is enabled, number of documents
166-
passed to :pipeline:`$group`, :pipeline:`$bucket`, and
150+
- When :guilabel:`Sample Mode` is enabled, specifies the number of
151+
documents passed to :pipeline:`$group`, :pipeline:`$bucket`, and
167152
:pipeline:`$bucketAuto` stages. Lower limits improve pipeline
168-
execution time, but may miss documents.
153+
running time, but may miss documents.
169154
- 100000
170155

171156
#. Click :guilabel:`Apply` to save changes and close the
172157
:guilabel:`Settings` panel.
173158

159+
.. _pipeline-custom-collation:
160+
161+
Specify Custom Collation
162+
------------------------
163+
164+
Use :manual:`custom collation </reference/collation/>` to specify
165+
language-specific rules for string comparison, such as rules for
166+
letter case and accent marks.
167+
168+
To specify a custom collation:
169+
170+
#. Click the :guilabel:`Collation` button at the top of the pipeline
171+
builder.
172+
173+
#. Enter your collation document.
174+
175+
.. _create-a-view:
176+
177+
Create a View from Pipeline Results
178+
-----------------------------------
179+
180+
.. note::
181+
182+
Creating a view from pipeline results does not save the pipeline
183+
itself.
184+
185+
To create a view from your pipeline results:
186+
187+
.. include:: /includes/fact-create-view-from-pipeline.rst
188+
174189
Example
175190
-------
176191

177-
The following example walks through creating and executing a pipeline
178-
for a collection containing airline data. You can download this
192+
In this example, you create and run a pipeline
193+
for a collection with airline data. You can download this
179194
dataset from the following link:
180195
`air_airlines.json <https://raw.githubusercontent.com/mongodb/docs-assets/compass/air_airlines.json>`__.
181196

182197
For instructions on importing JSON data into your cluster, see
183198
:manual:`mongoimport </reference/program/mongoimport/>`. This
184-
procedure assumes you have the data in the
199+
example assumes you have the data in the
185200
``example.air_airlines`` namespace.
186201

187202

@@ -193,12 +208,11 @@ The following pipeline has two aggregation stages:
193208

194209
- The ``$group`` stage groups documents by their
195210
``active`` status and ``country``. The stage also adds
196-
a new field called ``flightCount`` containing the number
211+
a new ``flightCount`` field containing the number
197212
of documents in each group.
198213

199-
- The ``$match`` stage filters documents to only return
200-
those with a ``flightCount`` value greater than or
201-
equal to ``5``.
214+
- The ``$match`` stage filters documents to return documents
215+
with a ``flightCount`` value greater than or equal to ``5``.
202216

203217
.. figure:: /images/compass/agg-builder-full-example.png
204218
:alt: Aggregation Builder Full Example
@@ -207,18 +221,18 @@ Copy the Pipeline to the Clipboard
207221
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208222

209223
1. Click the :guilabel:`Export to Language` button at the top
210-
of the pipeline builder. The button opens the following modal:
224+
of the pipeline builder. The following page displays:
211225

212226
.. figure:: /images/compass/agg-builder-example-export-to-node.png
213227
:alt: Aggregation Builder Full Example
214228

215229
#. Click the :guilabel:`Copy` button in the :guilabel:`My Pipeline`
216-
panel on the left. This button copies your pipeline to your
230+
panel on the left. |compass-short| copies the pipeline to your
217231
clipboard in :binary:`~mongo` shell syntax. You will use the
218232
pipeline in the following section.
219233

220-
Execute the Pipeline
221-
~~~~~~~~~~~~~~~~~~~~
234+
Run the Pipeline
235+
~~~~~~~~~~~~~~~~
222236

223237
1. Launch and connect to a
224238
:manual:`mongod </reference/program/mongod/>` instance which contains the imported ``air_airlines.json`` dataset.
@@ -230,7 +244,7 @@ Execute the Pipeline
230244

231245
use example
232246

233-
#. Run the following command to execute the pipeline created in
247+
#. Run the following command to run the pipeline created in
234248
|compass-short|:
235249

236250
.. code-block:: javascript
@@ -253,8 +267,7 @@ Execute the Pipeline
253267
}
254268
}])
255269

256-
The following is an excerpt of the documents returned by
257-
the pipeline:
270+
The pipeline returns documents, as shown in the following abbreviated example:
258271

259272
.. code-block:: javascript
260273

source/includes/steps-create-agg-pipeline.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ level: 4
33
ref: add-pipeline-stage
44
content: |
55
6-
In the aggregation pipeline pane in the bottom-left of the view,
6+
In the aggregation pipeline pane in the lower-left corner,
77
click the :guilabel:`Select...` dropdown and select the
88
:manual:`aggregation pipeline stage
99
</reference/operator/aggregation-pipeline/>` to use for the first
@@ -16,10 +16,10 @@ title: Fill in the pipeline stage.
1616
level: 4
1717
ref: fill-in-stage
1818
content: |
19-
Fill in your selected stage. As you modify the pipeline stage, the
20-
preview documents shown in the pane to the right of the stage
21-
update automatically to reflect the results of your pipeline as it
22-
progresses, provided :guilabel:`Auto Preview` is enabled:
19+
Fill in your selected stage. If you enable :guilabel:`Auto Preview`,
20+
preview documents update automatically to the right of the stage to
21+
reflect the results of your pipeline as it progresses. You can adjust
22+
the width of the pipeline stage by dragging its border to the right.
2323
2424
.. figure:: /images/compass/agg-builder-match-stage.png
2525
:alt: Aggregation Builder match stage example
@@ -29,8 +29,8 @@ title: Add additional pipeline stages.
2929
level: 4
3030
ref: add-additional-stages
3131
content: |
32-
Add additional aggregation stages as desired by clicking the
33-
:guilabel:`Add Stage` button below your last aggregation stage.
32+
Click :guilabel:`Add Stage` to add additional aggregation stages
33+
below your last aggregation stage.
3434
Repeat steps 1 and 2 for each additional stage.
3535
3636
.. note::

0 commit comments

Comments
 (0)