@@ -14,65 +14,59 @@ Aggregation Pipeline Builder
14
14
15
15
*New in version 1.14.0*
16
16
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.
23
22
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.
31
29
32
- To populate the Aggregation Pipeline Builder, you can either :
30
+ You can:
33
31
34
- - :ref:`Create a new Aggregation Pipeline in the UI <create-agg-pipeline>`,
32
+ - :ref:`Create a new aggregation pipeline <create-agg-pipeline>`
35
33
36
- - :ref:`Open a saved pipeline <open-saved -pipeline>`, or
34
+ - :ref:`Save a pipeline <save-agg -pipeline>`
37
35
38
- - :ref:`Import a Pipeline from Plain Text <compass-import -pipeline>`
36
+ - :ref:`Open a saved pipeline <open-saved -pipeline>`
39
37
40
- .. _create-agg-pipeline:
38
+ - :ref:`Set the documents limit or auto preview documents <use-sample-mode-or-auto-preview>`
41
39
42
- Create an Aggregation Pipeline
43
- ------------------------------
40
+ - :ref:`View or change pipeline settings <change-pipeline-settings>`
44
41
45
- .. include:: /includes/steps/create-agg-pipeline.rst
42
+ - :ref:`Specify custom collation <pipeline-custom-collation>`
46
43
47
- .. _pipeline-custom-collation:
44
+ - :ref:`Create a view from pipeline results <create-a-view>`
48
45
49
- Specify Custom Collation
50
- ~~~~~~~~~~~~~~~~~~~~~~~~
46
+ - :ref:`Import a pipeline from plain text <compass-import-pipeline>`
51
47
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>`
55
49
56
- To specify a custom collation:
50
+ Limitations
51
+ -----------
57
52
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>`__ .
60
55
61
- #. Enter your collation document.
56
+ .. _create-agg-pipeline:
62
57
63
- Limitations
64
- ~~~~~~~~~~~
58
+ Create an Aggregation Pipeline
59
+ ------------------------------
65
60
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
68
62
69
63
.. _save-agg-pipeline:
70
64
71
65
Save a Pipeline
72
66
---------------
73
67
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
76
70
changing the original saved copy. You can also create a :ref:`view
77
71
<view-details>` from your pipeline results.
78
72
@@ -85,20 +79,6 @@ To save your pipeline:
85
79
86
80
#. Click :guilabel:`Save`.
87
81
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
-
102
82
.. _open-saved-pipeline:
103
83
104
84
Open a Saved Pipeline
@@ -111,11 +91,13 @@ Open a Saved Pipeline
111
91
112
92
#. In the modal, click :guilabel:`Open Pipeline`.
113
93
114
- Pipeline Options
115
- ----------------
94
+ .. _use-sample-mode-or-auto-preview:
116
95
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.
119
101
120
102
.. list-table::
121
103
:header-rows: 1
@@ -134,15 +116,17 @@ following options:
134
116
preview documents pane to reflect the results of each active
135
117
stage as the pipeline progresses.
136
118
137
- Pipeline Settings
138
- ~~~~~~~~~~~~~~~~~
119
+ .. _change-pipeline-settings:
120
+
121
+ View or Change Pipeline Settings
122
+ --------------------------------
139
123
140
- To view and modify pipeline settings:
124
+ To view and change pipeline settings:
141
125
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
143
127
open the :guilabel:`Settings` panel.
144
128
145
- #. Modify the pipeline settings. The following settings can be modified:
129
+ #. Change any of the following pipeline settings.
146
130
147
131
.. list-table::
148
132
:header-rows: 1
@@ -159,29 +143,60 @@ To view and modify pipeline settings:
159
143
- 20
160
144
* - .. data:: Max Time
161
145
- 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.
163
148
- 5000
164
149
* - .. 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
167
152
:pipeline:`$bucketAuto` stages. Lower limits improve pipeline
168
- execution time, but may miss documents.
153
+ running time, but may miss documents.
169
154
- 100000
170
155
171
156
#. Click :guilabel:`Apply` to save changes and close the
172
157
:guilabel:`Settings` panel.
173
158
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
+
174
189
Example
175
190
-------
176
191
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
179
194
dataset from the following link:
180
195
`air_airlines.json <https://raw.githubusercontent.com/mongodb/docs-assets/compass/air_airlines.json>`__.
181
196
182
197
For instructions on importing JSON data into your cluster, see
183
198
:manual:`mongoimport </reference/program/mongoimport/>`. This
184
- procedure assumes you have the data in the
199
+ example assumes you have the data in the
185
200
``example.air_airlines`` namespace.
186
201
187
202
@@ -193,12 +208,11 @@ The following pipeline has two aggregation stages:
193
208
194
209
- The ``$group`` stage groups documents by their
195
210
``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
197
212
of documents in each group.
198
213
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``.
202
216
203
217
.. figure:: /images/compass/agg-builder-full-example.png
204
218
:alt: Aggregation Builder Full Example
@@ -207,18 +221,18 @@ Copy the Pipeline to the Clipboard
207
221
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208
222
209
223
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 :
211
225
212
226
.. figure:: /images/compass/agg-builder-example-export-to-node.png
213
227
:alt: Aggregation Builder Full Example
214
228
215
229
#. 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
217
231
clipboard in :binary:`~mongo` shell syntax. You will use the
218
232
pipeline in the following section.
219
233
220
- Execute the Pipeline
221
- ~~~~~~~~~~~~~~~~~~~~
234
+ Run the Pipeline
235
+ ~~~~~~~~~~~~~~~~
222
236
223
237
1. Launch and connect to a
224
238
:manual:`mongod </reference/program/mongod/>` instance which contains the imported ``air_airlines.json`` dataset.
@@ -230,7 +244,7 @@ Execute the Pipeline
230
244
231
245
use example
232
246
233
- #. Run the following command to execute the pipeline created in
247
+ #. Run the following command to run the pipeline created in
234
248
|compass-short|:
235
249
236
250
.. code-block:: javascript
@@ -253,8 +267,7 @@ Execute the Pipeline
253
267
}
254
268
}])
255
269
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:
258
271
259
272
.. code-block:: javascript
260
273
0 commit comments