Docs Menu

Docs HomeView & Analyze DataMongoDB Compass

Create an Aggregation Pipeline

On this page

  • About this Task
  • Before You Begin
  • Steps
  • Learn More

The Aggregation Pipeline Builder in MongoDB Compass helps you create aggregation pipelines to process documents from a collection or view and return computed results.

MongoDB Compass provides different modes to create aggregation pipelines:

  • Stage View Mode, a visual pipeline editor that preloads pipeline syntax based on your selected stages.

  • Stage Wizard, a feature of Stage View Mode that provides a set of templates for simple aggregation stage use cases. The Stage Wizard only includes simple use cases to help you get started with your aggregation pipeline.

  • Focus Mode, a feature of Stage View Mode where you edit one pipeline stage at a time. Focus Mode helps you manage complex or deeply nested aggregation pipeline stages.

  • Text View Mode, a text-based pipeline editor that accepts raw pipeline syntax.

To build an aggregation pipeline, choose a collection and click the Aggregations tab. Compass displays a blank aggregation pipeline. The Preview of Documents in the Collection section shows 10 documents randomly sampled from the chosen collection.

Note

Atlas Search Stages

When you connect Compass to a MongoDB deployment hosted on Atlas, additional Atlas-only stages $search and $searchMeta are available in the Aggregation Pipeline Builder. Use these stages to perform full-text search on Atlas collections.

To see how to create an aggregation pipeline, select the tab corresponding to your chosen view mode:

← Embedded MongoDB Shell