@@ -40,6 +40,10 @@ You can:
40
40
41
41
- :ref:`View or change pipeline settings <change-pipeline-settings>`
42
42
43
+ - :ref:`View the explain plan for pipelines <explain-plan-pipeline>`
44
+
45
+ - :ref:`Export Aggregation Results <export-agg-builder-results>`
46
+
43
47
- :ref:`Specify custom collation <pipeline-custom-collation>`
44
48
45
49
- :ref:`Create a view from pipeline results <create-a-view>`
@@ -74,10 +78,18 @@ Open a Saved Pipeline
74
78
---------------------
75
79
76
80
1. Click the :guilabel:`Folder` icon at the top left of the
77
- pipeline builder.
81
+ pipeline builder.
82
+
83
+ .. figure:: /images/compass/saved-pipeline-icon.png
84
+ :figwidth: 316px
85
+ :alt: Saved Pipeline Icon
78
86
79
87
#. Hover over the pipeline you want to open and click :guilabel:`Open`.
80
88
89
+ .. figure:: /images/compass/saved-pipelines.png
90
+ :figwidth: 316px
91
+ :alt: Saved Pipelines List
92
+
81
93
#. In the modal, click :guilabel:`Open Pipeline`.
82
94
83
95
.. note::
@@ -139,11 +151,6 @@ To view and change pipeline settings:
139
151
* - .. data:: Number of Preview Documents
140
152
- Number of documents to show in the preview.
141
153
- 20
142
- * - .. data:: Max Time
143
- - Cumulative time limit in milliseconds for processing
144
- the pipeline. Use this option to limit the waiting time if
145
- the pipeline stops responding.
146
- - 5000
147
154
* - .. data:: Limit
148
155
- When :guilabel:`Sample Mode` is enabled, specifies the number of
149
156
documents passed to :pipeline:`$group`, :pipeline:`$bucket`, and
@@ -154,6 +161,27 @@ To view and change pipeline settings:
154
161
#. Click :guilabel:`Apply` to save changes and close the
155
162
:guilabel:`Settings` panel.
156
163
164
+ .. _explain-plan-pipeline:
165
+
166
+ Explain Plan for Pipelines
167
+ --------------------------
168
+
169
+ Use the :guilabel:`Explain` button to view the explain plan that helps you
170
+ understand the performance of your pipelines. You can view the explain plan
171
+ at any point while creating or editing your pipeline.
172
+
173
+ To view your pipeline explain plan, click :guilabel:`Explain` in the
174
+ right corner of your pipeline toolbar.
175
+
176
+ .. figure:: /images/compass/agg-explain-plan.png
177
+ :alt: Aggregation Pipeline Builder Explain Plan
178
+
179
+ Your results are presented in this format:
180
+
181
+ .. figure:: /images/compass/agg-explain-results.png
182
+ :figwidth: 450px
183
+ :alt: Aggregation Pipeline Builder Explain Results
184
+
157
185
.. _pipeline-custom-collation:
158
186
159
187
Specify Custom Collation
@@ -165,11 +193,55 @@ letter case and accent marks.
165
193
166
194
To specify a custom collation:
167
195
168
- #. Click the :guilabel:`Collation` button at the top of the pipeline
169
- builder.
196
+ #. Click :guilabel:`More Options` in the top right corner of the pipeline
197
+ builder.
198
+
199
+ .. figure:: /images/compass/options-collation.png
200
+ :alt: Collation Option
170
201
171
202
#. Enter your collation document.
172
203
204
+ .. _export-agg-builder-results:
205
+
206
+ Export Aggregation Results
207
+ --------------------------
208
+
209
+ To export results from your aggregation pipeline:
210
+
211
+ #. Connect to the deployment containing the
212
+ :doc:`collection </collections>` you wish to export data from.
213
+
214
+ To learn how to connect to a deployment, see
215
+ :ref:`connect-run-compass`.
216
+
217
+ #. Navigate to your target collection.
218
+
219
+ You can either select the collection from the
220
+ :doc:`Collections </collections>` tab or click the collection
221
+ in the left-hand pane.
222
+
223
+ #. Create an aggregation pipeline and run for results.
224
+
225
+ To learn how to create an aggregation pipeline, see :ref:`Create an
226
+ Aggregation Pipeline <create-agg-pipeline>`.
227
+
228
+ #. Click :guilabel:`Export`.
229
+
230
+ #. Choose the appropriate file type.
231
+
232
+ Under :guilabel:`Select Export File Type`, select either
233
+ :guilabel:`JSON` or :guilabel:`CSV`. If you select :guilabel:`JSON`,
234
+ your data is exported to the target file as an array of JSON objects.
235
+
236
+ #. Under :guilabel:`Output`, choose where to export the file to.
237
+
238
+ .. figure:: /images/compass/aggregation-export.png
239
+ :alt: Export Aggregation Data
240
+ :width: 70%
241
+
242
+ #. Click :guilabel:`Export`.
243
+
244
+
173
245
.. _create-a-view:
174
246
175
247
Create a View from Pipeline Results
@@ -192,91 +264,45 @@ for a collection with airline data. You can download this
192
264
dataset from the following link:
193
265
`air_airlines.json <https://raw.githubusercontent.com/mongodb/docs-assets/compass/air_airlines.json>`__.
194
266
195
- For instructions on importing JSON data into your cluster, see
196
- :manual:`mongoimport </reference/program/mongoimport/>`. This
197
- example assumes you have the data in the
267
+ For instructions on importing JSON data into your cluster, see :ref:`Import Data
268
+ into a Collection <import-data>`. This example assumes you have the data in the
198
269
``example.air_airlines`` namespace.
199
270
271
+ Procedure
272
+ ~~~~~~~~~
200
273
201
- Create the Pipeline
202
- ~~~~~~~~~~~~~~~~~~~
274
+ 1. Connect to a database deployment. For information on how to connect to a
275
+ database deployment, see :atlas:`Connect via Compass </compass-connection/>`.
203
276
204
- The following pipeline has two aggregation stages:
205
- :pipeline:`$group` and :pipeline:`$match`.
277
+ #. Select the ``example`` database where the ``air_airlines`` collection
278
+ exists.
206
279
207
- - The ``$group`` stage groups documents by their
208
- ``active`` status and ``country``. The stage also adds
209
- a new ``flightCount`` field containing the number
210
- of documents in each group.
280
+ #. Create the Pipeline
211
281
212
- - The ``$match`` stage filters documents to return documents
213
- with a ``flightCount`` value greater than or equal to ``5``.
282
+ |
214
283
215
- .. figure:: /images/compass/agg-builder-full-example.png
216
- :alt: Aggregation Builder Full Example
284
+ The following pipeline has two aggregation stages:
285
+ :pipeline:`$group` and :pipeline:`$match`.
217
286
218
- Copy the Pipeline to the Clipboard
219
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
287
+ - The ``$group`` stage groups documents by their
288
+ ``active`` status and ``country``. The stage also adds
289
+ a new ``flightCount`` field containing the number
290
+ of documents in each group.
220
291
221
- 1. Click the :guilabel:`Export to Language` button at the top
222
- of the pipeline builder. The following page displays:
292
+ - The ``$match`` stage filters documents to return documents
293
+ with a ``flightCount`` value greater than or equal to ``5``.
223
294
224
- .. figure:: /images/compass/agg-builder-example-export-to-node .png
225
- :alt: Aggregation Builder Full Example
295
+ .. figure:: /images/compass/agg-builder-full-example .png
296
+ :alt: Aggregation Builder Full Example
226
297
227
- #. Click the :guilabel:`Copy` button in the :guilabel:`My Pipeline`
228
- panel on the left. |compass-short| copies the pipeline to your
229
- clipboard in :binary:`~mongo` shell syntax. You will use the
230
- pipeline in the following section.
298
+ #. Run the Pipeline.
231
299
232
- Run the Pipeline
233
- ~~~~~~~~~~~~~~~~
234
-
235
- 1. Launch and connect to a
236
- :manual:`mongod </reference/program/mongod/>` instance which contains the imported ``air_airlines.json`` dataset.
237
-
238
- #. Switch to the ``example`` database where the ``air_airlines``
239
- collection exists:
240
-
241
- .. code-block:: javascript
242
-
243
- use example
244
-
245
- #. Run the following command to run the pipeline created in
246
- |compass-short|:
247
-
248
- .. code-block:: javascript
249
-
250
- db.air_airlines.aggregate([{
251
- $group: {
252
- _id: {
253
- active: '$active',
254
- country: '$country'
255
- },
256
- flightCount: {
257
- $sum: 1
258
- }
259
- }
260
- }, {
261
- $match: {
262
- flightCount: {
263
- $gte: 5
264
- }
265
- }
266
- }])
300
+ Click :guilabel:`Run` at the top right of the pipeline builder.
267
301
268
302
The pipeline returns documents, as shown in the following abbreviated example:
269
303
270
- .. code-block:: javascript
271
-
272
- { "_id" : { "active" : "Y", "country" : "Nigeria" }, "flightCount" : 5 }
273
- { "_id" : { "active" : "N", "country" : "Switzerland" }, "flightCount" : 46 }
274
- { "_id" : { "active" : "N", "country" : "Bahrain" }, "flightCount" : 8 }
275
- { "_id" : { "active" : "N", "country" : "Guinea-Bissau" }, "flightCount" : 8 }
276
- { "_id" : { "active" : "N", "country" : "Argentina" }, "flightCount" : 14 }
277
- { "_id" : { "active" : "N", "country" : "Moldova" }, "flightCount" : 17 }
278
- { "_id" : { "active" : "Y", "country" : "Israel" }, "flightCount" : 6 }
279
- { "_id" : { "active" : "N", "country" : "Finland" }, "flightCount" : 7 }
304
+ .. figure:: /images/compass/airline-example-results.png
305
+ :alt: Airline Pipeline Results
280
306
281
307
.. toctree::
282
308
:titlesonly:
0 commit comments