# The Aggregation Pipeline — MongoDB Fundamentals: Documents, Queries and Indexes

Source: https://www.skillbyai.com/en/mongodb/mongo-aggregation-pipeline

> Transform data through aggregation pipeline stages such as $match, $group, $sort and $project.

## Pipeline of stages

The **aggregation pipeline** passes documents through an array of stages, each transforming the data before handing it to the next.

## Common stages

`$match` filters documents, `$group` aggregates by a key, `$sort` orders results, `$project` reshapes fields.
