Docs Menu

Docs HomeMongoDB Compass

Import Pipeline from Text

On this page

  • Syntax
  • Procedure

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.

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.


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

  1. Click the arrow next to the icon at the top of the pipeline builder.

  2. Click New Pipeline From Text.


If you have a pre-written 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

Once you import your pipeline, you can add and modify individual stages and see the results reflected in the Output of each respective stage.

←  Aggregation Pipeline BuilderExport Pipeline to Specific Language →

On this page

Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.