Lesson 13 / 22

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