Suggest an editImprove this articleRefine the answer for “What does "aggregation pipeline" mean?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)An aggregation pipeline is a data-processing conveyor in MongoDB, where documents pass through a sequence of stages, each one transforming the data step by step: filtering, sorting, grouping, projecting, and so on; the output of one stage becomes the input for the next. **Key point:** everything happens on MongoDB's side, so you're not pulling a lot of data into your code, you're processing it right inside the DB - faster and more efficiently.Shown above the full answer for quick recall.Answer (EN)ImageAn aggregation pipeline is a **data-processing conveyor in MongoDB**, where documents pass through a **sequence of stages**, each one transforming the data step by step: filtering, sorting, grouping, projecting, and so on. ### The key ideas 1. **A pipeline is a chain of stages** Data flows top to bottom, like through pipes. One stage's output is the next stage's input. 2. **Every stage does one clear thing** For example: - `$match`, a filter - `$group`, grouping and aggregates - `$sort`, sorting - `$project`, picking and changing fields 3. **Everything happens on MongoDB's side** So you're not pulling a lot of data into your code, you're processing it right inside the DB, which is faster and more efficient. ### Example ```js db.orders.aggregate([ { $match: { status: "paid" } }, { $group: { _id: "$user_id", total: { $sum: "$amount" } } }, { $sort: { total: -1 } } ]); ``` - first a filter by `status` - then a sum per user - then sorting by the total ### Summary An **aggregation pipeline** is a mechanism where data passes through a chain of stages, gets transformed step by step, and produces a finished analytical result in a single query.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.