MongoDB Aggregation Pipeline

Parent: MongoDB Expert Knowledge · researched 2026-05-28T15:12:34.482Z· 11 sources · 10 concepts · skill mongodb-aggregation-pipeline

Stages execute left-to-right; each stage receives the document stream from the previous

1. Pipeline Stages Reference

2a. Equality join (localField / foreignField)

2b. Correlated sub-query (let + pipeline)

2c. Performance checklist for $lookup

3a. $out — full collection replacement

3b. $merge — incremental / upsert update

4a. Place $match (and $sort) early

4b. Project down early to shrink per-document size

5a. $expr in $match — field-to-field comparisons

5d. $accumulator — custom group-level accumulation

5e. $function — inline custom JavaScript per document

6. Window Functions ($setWindowFields)

7a. $densify — fill temporal gaps

7c. Native time series collections

9a. Default per-stage limit

9b. allowDiskUse

10c. Java — MongoDB Driver 5.x (sync)

References

Time Series Collection Aggregation Notes

See also

Children

Frontier under this node: $lookup Patterns, $merge and $out Materialized Views, Aggregation Expressions, Driver Examples (Node.js, Python, Java), Memory Limits and allowDiskUse, Pipeline Optimization, Pipeline Stages Reference, Time Series Aggregation, Window Functions ($setWindowFields)

← the whole tree · 3D view· how to read this page