MongoDB Aggregation Pipeline

Parent: MongoDB Expert Knowledge · Published reference · snapshot 2026-09-08 · skill mongodb-expert/references/mongodb-aggregation-pipeline.md

↓ Facts as markdownall context files

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

These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.

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

Project ideas

Where this helps

Common mistakes

Known issues

Children

Frontier under this node: 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