MongoDB Aggregation Pipeline
The aggregation pipeline processes documents through a sequence of stages.
Learning Objectives
Lesson Outline
The aggregation pipeline processes documents through a sequence of stages.
| Stage | Purpose |
|---|---|
| $match | Filter documents (like find) |
| $project | Reshape documents, select fields |
| $group | Group by field, perform aggregations |
| $sort | Order documents |
| $limit | Limit number of documents |
| $skip | Skip documents |
| $unwind | Deconstruct array field |
| $lookup | Join with another collection |
| $addFields | Add new fields |
| $count | Count documents |