Aggregation Pipeline
Stages transform documents in order.
Example
db.orders.aggregate([
{ $match: { status: "paid" } },
{ $group: { _id: "$customer", total: { $sum: "$amount" } } },
{ $sort: { total: -1 } }
])Exercise
Filter stage.
{ : { status: "paid" } }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.