Docs Menu

Docs HomeView & Analyze DataMongoDB Compass

Managing Saved Queries and Aggregations

On this page

  • Saving an Aggregation Pipeline
  • Saving a Favorite Query
  • Viewing Saved Queries
  • Viewing Query History

Starting in MongoDB Compass 1.31, you can load saved queries and aggregations from the My Queries view once you are connected to your cluster. This page explains how to add and view favorite queries and aggregations.

You can save a pipeline so that you can find it later. If you load a saved pipeline, you can change it without changing the original saved copy. You can also create a view from your pipeline results.

To save your pipeline:

1

Click the Save dropdown button at the top of the pipeline builder. Click on Save pipeline as...

Save pipeline as
click to enlarge
2
Name your pipeline
click to enlarge
3

You can favorite a query so that you can find it later. If you load a favorite query, you can change it without changing the original saved copy.

To add a query to your favorites:

1

Click the History button at the top of the pipeline builder.

Click history button
2

Click the Star button.

Click star button
3

Enter a name for your query.

Save favorite query

Starting in MongoDB Compass 1.31, you can view your saved queries and aggregation pipelines on the My Queries view once connected to your cluster.

When you click a saved or favorite query tile, Compass opens the Documents tab with the filter loaded.

When you click a saved or favorite pipeline tile, Compass opens the Aggregations tab with the pipeline loaded.

My queries view
click to enlarge

You can also view favorite queries from the Favorites tab from in the Documents view. To open the Favorites tab:

1

Click the History button at the top of the Documents tab.

Query history view
click to enlarge
2

Click the Favorites button in the past queries pane.

Favorites

For details on how to view query history see viewing recent query history.

← Export Query to Specific Language