Navigation

Import Pipeline from Text

On this page

New in version 1.15.0

You can import aggregation pipelines from plain text into the Aggregation Pipeline Builder to easily modify and execute your pipelines. Importing a plain text aggregation pipeline shows how each stage of the pipeline affects the output, and illustrates the effects of modifying specific pipeline stages using the Pipeline Builder’s Output panes.

Syntax

The imported pipeline must be in the MongoDB query language (i.e. the same syntax used as the pipeline parameter of the db.collection.aggregate() method). The imported pipeline must be an array, even if there is only one stage in the pipeline.

Procedure

Important

Importing a new pipeline abandons any unsaved changes to the pipeline you are currently working on. If the circle at the top-right of the Aggregations view is orange, this means you have unsaved changes to your pipeline.

1

Open the Aggregation Pipeline Builder for the desired collection.

Navigate to the collection for which you wish to import your aggregation pipeline. Click the Aggregations tab.

2

Open the New Pipeline From Plain Text dialog.

  1. Click the Ellipses (…) button at the top of the Aggregations view.
  2. Click New Pipeline From Text.
3

Enter your pipeline in the dialog.

If you have a prewritten pipeline you wish to import into the Aggregation Pipeline Builder, copy it to your clipboard and paste it into the New Pipeline from Plain Text dialog. Otherwise, type your pipeline in the input.

Import pipeline from text example
4

Click Create New to import your pipeline.

Once you have imported your pipeline, if Auto Preview is enabled, the pipeline automatically executes. You can now modify individual stages of your pipeline, and see the results of those modifications reflected in the Output pane to the right of each respective stage.