Skip to content

Commit cfa8880

Browse files
jocelyn-mendez1Jocelyn Mendez
andauthored
DOCSP-22847 New Aggregation Toolbar (#412)
* DOCSP-22848 Updating Aggregation Pipeline Builder page to show new toolbar (#403) * DOCSP-22848 updating aggregation page with new pipeline toolbar * DOCSP-22848 added step to include run button * DOCSP-22848 updated screenshots * DOCSP-22848 updated screenshots Co-authored-by: Jocelyn Mendez <[email protected]> * DOCSP-22849 exporting aggregation results (#404) Co-authored-by: Jocelyn Mendez <[email protected]> * DOCSP-22962 New Explain Plan for Aggregation Pipeline Builder (#407) * DOCSP-22962 explain plan for pipelines * DOCSP-22962 fix image * DOCSP-22962 fix image * DOCSP-22962 internal feedback * DOCSP-22962 rewording * DOCSP-22962 rewording * DOCSP-22962 adding ref * DOCSP-22962 updated screenshot Co-authored-by: Jocelyn Mendez <[email protected]> * DOCSP-22847 adding export to agg builder page * DOCSP-22847 reworked agg-builder example * DOCSP-22847 reworked agg-builder example * DOCSP-22847 reworked agg-builder example * DOCSP-22847 small changes * DOCSP-22847 desired to target * DOCSP-22847 removed then Co-authored-by: Jocelyn Mendez <[email protected]>
1 parent de5102c commit cfa8880

23 files changed

+178
-85
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"esbonio.server.enabled": true
2+
"esbonio.server.enabled": true,
3+
"esbonio.sphinx.confDir": ""
34
}

source/aggregation-pipeline-builder.txt

Lines changed: 104 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ You can:
4040

4141
- :ref:`View or change pipeline settings <change-pipeline-settings>`
4242

43+
- :ref:`View the explain plan for pipelines <explain-plan-pipeline>`
44+
45+
- :ref:`Export Aggregation Results <export-agg-builder-results>`
46+
4347
- :ref:`Specify custom collation <pipeline-custom-collation>`
4448

4549
- :ref:`Create a view from pipeline results <create-a-view>`
@@ -74,10 +78,18 @@ Open a Saved Pipeline
7478
---------------------
7579

7680
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
7886

7987
#. Hover over the pipeline you want to open and click :guilabel:`Open`.
8088

89+
.. figure:: /images/compass/saved-pipelines.png
90+
:figwidth: 316px
91+
:alt: Saved Pipelines List
92+
8193
#. In the modal, click :guilabel:`Open Pipeline`.
8294

8395
.. note::
@@ -139,11 +151,6 @@ To view and change pipeline settings:
139151
* - .. data:: Number of Preview Documents
140152
- Number of documents to show in the preview.
141153
- 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
147154
* - .. data:: Limit
148155
- When :guilabel:`Sample Mode` is enabled, specifies the number of
149156
documents passed to :pipeline:`$group`, :pipeline:`$bucket`, and
@@ -154,6 +161,27 @@ To view and change pipeline settings:
154161
#. Click :guilabel:`Apply` to save changes and close the
155162
:guilabel:`Settings` panel.
156163

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+
157185
.. _pipeline-custom-collation:
158186

159187
Specify Custom Collation
@@ -165,11 +193,55 @@ letter case and accent marks.
165193

166194
To specify a custom collation:
167195

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
170201

171202
#. Enter your collation document.
172203

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+
173245
.. _create-a-view:
174246

175247
Create a View from Pipeline Results
@@ -192,91 +264,45 @@ for a collection with airline data. You can download this
192264
dataset from the following link:
193265
`air_airlines.json <https://raw.githubusercontent.com/mongodb/docs-assets/compass/air_airlines.json>`__.
194266

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
198269
``example.air_airlines`` namespace.
199270

271+
Procedure
272+
~~~~~~~~~
200273

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/>`.
203276

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.
206279

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
211281

212-
- The ``$match`` stage filters documents to return documents
213-
with a ``flightCount`` value greater than or equal to ``5``.
282+
|
214283

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`.
217286

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.
220291

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``.
223294

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
226297

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.
231299

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.
267301

268302
The pipeline returns documents, as shown in the following abbreviated example:
269303

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
280306

281307
.. toctree::
282308
:titlesonly:
Loading
Loading
Loading
Loading
Loading
Loading
230 KB
Loading
142 KB
Loading
60.9 KB
Loading
Loading
202 KB
Loading
Loading
Loading

source/images/compass/run-results.png

272 KB
Loading
203 KB
Loading
32.8 KB
Loading

source/import-export.txt

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ or from a collection, navigate to the detailed collection view by either
2323
selecting the collection from the :doc:`Databases </databases>` tab or
2424
clicking the collection in the left-side navigation.
2525

26+
.. _import-data:
27+
2628
Import Data into a Collection
2729
-----------------------------
2830

@@ -124,8 +126,10 @@ Export Data from a Collection
124126

125127
|compass| can export data from a collection as either a
126128
**JSON** or **CSV** file. If you specify a
127-
:ref:`filter <query-bar-filter>`, |compass-short| only exports
128-
documents which match the specified query.
129+
:ref:`filter <query-bar-filter>` or :ref:`aggregation pipeline
130+
<compass-agg-builder>` for your collection, |compass-short| only exports
131+
documents which match the specified query or
132+
pipeline results.
129133

130134
Behavior
131135
~~~~~~~~
@@ -158,6 +162,46 @@ Procedure
158162
.. include:: /includes/steps/export-filter.rst
159163

160164
.. include:: /includes/fact-export-progress-bar.rst
165+
166+
.. tab:: Export Aggregation Results
167+
:tabid: export-Aggregation
168+
169+
To export results from your aggregation pipeline:
170+
171+
.. procedure::
172+
:style: normal
173+
174+
.. step:: Connect to the deployment containing the :doc:`collection </collections>` you wish to export data from.
175+
176+
To learn how to connect to a deployment, see
177+
:ref:`connect-run-compass`.
178+
179+
.. step:: Navigate to your target collection.
180+
181+
You can either select the collection from the
182+
:doc:`Collections </collections>` tab or click the collection
183+
in the left-hand pane.
184+
185+
.. step:: Create an aggregation pipeline and run for results.
186+
187+
To learn how to create an aggregation pipeline, see :ref:`Create an
188+
Aggregation Pipeline <create-agg-pipeline>`.
189+
190+
.. step:: Click :guilabel:`Export`.
191+
192+
.. step:: Choose the appropriate file type.
193+
194+
Under :guilabel:`Select Export File Type`, select either
195+
:guilabel:`JSON` or :guilabel:`CSV`. If you select :guilabel:`JSON`,
196+
your data is exported to the target file as an array of JSON objects.
197+
198+
Then, under :guilabel:`Output`, choose where to export the file to.
199+
200+
.. figure:: /images/compass/aggregation-export.png
201+
:alt: Export Aggregation Data
202+
:width: 70%
203+
204+
.. step:: Click :guilabel:`Export`.
161205

162206
Import and Export Data from the Command Line
163207
--------------------------------------------

source/includes/fact-save-pipeline.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ To save your pipeline:
2323
:figwidth: 316px
2424
:alt: Name your pipeline
2525

26-
.. step:: Click :guilabel:`Save`
26+
.. step:: Click :guilabel:`Save`

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,27 @@ content: |
5050
5151
.. figure:: /images/compass/agg-builder-exclude-stage-example.png
5252
:alt: Aggregation Builder exclude stage example
53-
...
53+
---
54+
title: Run the pipeline.
55+
level: 4
56+
ref: run-aggregation
57+
content: |
58+
Click :guilabel:`Run` at the top right of the pipeline builder.
59+
|compass-short| returns your results in the document view.
60+
61+
.. warning::
5462
63+
When you click :guilabel:`Run`, the aggregation runs against the entire
64+
collection.
65+
66+
.. figure:: /images/compass/run-results.png
67+
:alt: Results after Running Aggregation
68+
---
69+
title: Edit the pipeline.
70+
level: 4
71+
ref: edit-after-run
72+
content: |
73+
Click :guilabel:`Edit` at the top of your pipeline toolbar to return to the
74+
aggregation pipeline builder. You can make changes to your pipeline from
75+
there.
76+
...

source/includes/steps-export-pipeline-to-language.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ content: |
7474
title: Click :guilabel:`Close`.
7575
level: 4
7676
ref: click-close
77-
...
77+
...

source/includes/steps-import.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ content: |
66
To learn how to connect to a deployment, see
77
:ref:`connect-run-compass`.
88
---
9-
title: Navigate to your desired collection.
9+
title: Navigate to your target collection.
1010
level: 4
1111
ref: select-collection
1212
content: |

0 commit comments

Comments
 (0)