Lesson 13 / 23
The Aggregation Pipeline
Transform data through aggregation pipeline stages such as $match, $group, $sort and $project.
By Rahul Agarwal · 15 years in web development · Updated 1 Oct 2026
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.