# The Aggregation Pipeline — MongoDB

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

> Transform documents through a sequence of stages.

## 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.
