Aggregation Pipeline Builder

Build MongoDB aggregation pipelines visually. Add stages, preview intermediate results, and export the finished pipeline — all inside a native macOS interface.

Why a Visual Pipeline Builder?

Aggregation pipelines are one of MongoDB's most powerful features, but writing them by hand is tedious. You need to keep the stage order in your head, guess at intermediate results, and debug by adding and removing stages one at a time.

Mongon's pipeline builder gives you a visual canvas where each stage is a discrete block. You can see what each stage does to your data before running the full pipeline.

Aggregation pipeline builder in Mongon showing multiple stages

Stage-by-Stage Preview

Click on any stage in the pipeline to see the intermediate output at that point. This lets you understand exactly how your data transforms at each step — without running the full pipeline or adding temporary stages.

  • Click stage 1 — see which documents pass the $match filter
  • Click stage 2 — see the grouped results after $group
  • Click stage 3 — see the reshaped documents after $project

This makes debugging pipelines straightforward. If a stage produces unexpected output, you know exactly where the problem is.

14 Supported Stages

Mongon supports all the stages you need for real-world aggregation work:

StageDescription
$matchFilter documents by a condition. Works like find() but inside the pipeline. Place it early to reduce the number of documents flowing through subsequent stages.
$groupGroup documents by a key and apply accumulators like $sum, $avg, $max, $min, $push, and $addToSet. The foundation of most analytics queries.
$projectReshape documents by including, excluding, or computing new fields. Use expressions to transform values, rename fields, or extract nested data.
$lookupPerform a left outer join with another collection. Bring related data into the pipeline without leaving the aggregation context.
$unwindDeconstruct an array field into one document per element. Commonly paired with $group to aggregate across array items.
$sortOrder documents by one or more fields. Supports ascending (1) and descending (-1) sort directions.
$limitRestrict the pipeline output to the first N documents. Useful for top-N queries and pagination.
$skipSkip the first N documents. Commonly used with $sort and $limit for offset-based pagination.
$countReturn a single document with a count of all documents that reach this stage. A quick way to get totals.
$addFieldsAdd new fields to documents without removing existing ones. Useful for computed values, defaults, and enriching data mid-pipeline.
$replaceRootPromote a nested document or expression to the top level. Replace the entire document structure with a subdocument or merged result.
$sampleReturn a random selection of N documents. Useful for testing, sampling data, and randomized queries.
$outWrite the pipeline output to a new or existing collection. Replaces the target collection entirely. Use for materialized views and ETL.
$mergeMerge pipeline output into an existing collection. More flexible than $out — supports insert, merge, replace, and fail-on-match strategies.

Date Macros in Pipelines

Mongon's date macros work inside aggregation pipelines, not just in the query builder. Use them in any stage that accepts date values:

// $match stage
{ "$match": { "createdAt": { "$gte": #startOfMonth } } }

This is especially useful for analytics pipelines where you regularly aggregate data over the last week, month, or quarter. Save the pipeline and it always operates on the correct date range.

How to Build a Pipeline

1

Open the pipeline builder

Select a collection and switch to the Aggregation tab. You start with an empty pipeline.

2

Add a stage

Click the add button to insert a new stage. Choose from the 14 supported stage types. Each stage has a dedicated editor with syntax highlighting.

3

Write the stage body

Enter the stage document in the editor. Full autocomplete, bracket matching, and date macro support are available.

4

Preview intermediate results

Click on any stage to see the output at that point. The preview runs only the stages up to and including the one you clicked.

5

Reorder, disable, or remove stages

Drag stages to reorder them. Toggle a stage off to temporarily exclude it without deleting. Remove stages you no longer need.

6

Run or export

Run the full pipeline to see the final results. Copy the raw MongoDB query or export the pipeline as a code snippet.

Export Your Pipeline

When your pipeline is ready, you can copy the raw MongoDB query to paste into the shell, driver code, or any other tool. The export preserves the exact stage structure and all options.

Common Use Cases

  • Analytics — group orders by month, sum revenue, compute averages
  • Reporting — reshape data for export with $project and $addFields
  • Data migration — transform and write to a new collection with $out or $merge
  • Joins — combine data from multiple collections using $lookup and $unwind
  • Debugging — use stage preview to understand how your data flows through the pipeline

Premium Feature

The aggregation pipeline builder is part of the Mongon premium plan. Premium is available as a one-time purchase or subscription (with a 2-week free trial). It also unlocks unlimited connections, 15 themes, export/import, change streams, CloudKit sync, and copy database.

Try Mongon for freeAggregation pipeline builder available with premium