Skip to content
Monghoul

Aggregation builder

Build a pipeline stage by stage with a live preview, or write it as code. The two views stay in sync.

Checked against v1.11.0 Updated
The visual aggregation builder with pipeline stages listed and a live preview of the output
Aggregation builder · Each stage previews its own output as you build

Building a pipeline

  • Visual builder with the whole stage catalog ($match, $group, $lookup, $facet, $graphLookup, $setWindowFields, $densify, $search, $vectorSearch, and more) in a searchable, categorized picker
  • Server version gating. Stages your server cannot run are marked and unavailable; the raw editor stays ungated
  • Color-coded stage badges by category: Filter & Sort, Transform, Group & Aggregate, Join & Combine, Output, Other
  • New stages start with useful templates, updated when you change the operator
  • Eight quick starts for a common multi-stage pipeline: Filter & Sort, Group & Count, Join Collections, Top N per Group, Time Series, Distinct Values, Reshape & Clean, and Multi-Facet Report. Applying one replaces the whole pipeline and can be undone
  • Insert a stage anywhere from the “+” on the connector between every pair
  • Reorder by drag-and-drop or with Move Up / Move Down
  • Per-stage enable/disable, collapse, duplicate, clear, delete, and Run To Here
  • Expand, collapse, enable, disable, or clear every stage in the pipeline in one action
  • A collapsed stage prints its own body on one line, so a folded pipeline can be read without expanding it

Writing a stage

  • Syntax errors are caught before execution and shown on the stage itself, expanded or collapsed
  • Schema-, type-, index-, variable-, and pipeline-aware autocomplete per stage editor
  • Index awareness the main query editor does not have: indexed fields and valid compound-index continuations rank first in $match and $sort
  • $lookup form helper with From, Local/Foreign field, and As dropdowns, synced both ways with the stage body

Previews and explain

  • The builder has no explain control of its own. The toolbar’s Explain runs the tab’s code without changing it, which in builder mode is the pipeline as last synchronized, so it explains the tab’s original query until the pipeline has been edited once
  • Stage previews inline, on collapsed cards as well as expanded ones, with an optional 20-document safety limit
  • Automatic preview refresh is off by default. Turned on, it waits for a pause in typing and is driven by body edits. Previews are cancellable from the current-operations panel
  • An edit discards previews from that stage downward, so a card never shows an older pipeline’s result as current
  • A failed preview names its root cause rather than the server’s wrapper chain, with the original message copyable

Safety, search and history

  • $out and $merge are visibly marked destructive and honor connection write protection
  • Stage search appears once a pipeline has four or more stages. Filter by operator name, description, or body
  • Undo/redo over structural changes, up to 50 history entries
  • Visual and code modes round-trip. The generated code sits in a togglable side panel and is copyable in place
  • Pipeline structure, enabled and collapsed state, collection, and editor mode persist with the tab