Docs Menu

Docs HomeMongoDB Compass

Import Pipeline from Text

On this page

  • Syntax
  • Procedure

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.

Note

Importing Pipelines From Text

Starting in Compass 1.35, the import pipeline button has been removed from the Compass GUI. The full functionality of importing pipelines from text is still supported as part of the View Pipeline as Text edit mode.

The imported pipeline must be:

  • In the MongoDB query language, this is the same syntax used in the pipeline parameter of the aggregate() method.

  • An array, even if there is only one stage in the pipeline.

1

In the aggregation pipeline pane, click the </> Text toggle switch to enable text mode for pipeline editing.

Toggle Textview Mode on
2

Type or paste an aggregation pipeline into the text editor. The text editor provides real-time linting for correct syntax and debugging information.

For example, the following pipeline consists of a single $limit stage:

[ { "$limit" : 4 } ]
Edit aggregation pipeline

After you import your pipeline, you can click the {} Stages switch to return to stage view mode. In this mode you can modify individual stages to 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.

About

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