MongoDB Tutorial 0/120 lessons ~6 min read Lesson 46
Aggregation Framework
The Aggregation Framework is MongoDB's data processing engine.
Course progress0%
Focus
4 guided sections
Practice signal
Concept-first lesson
Career prep
Foundation builder
Introduction
The Aggregation Framework is MongoDB's data processing engine. It transforms documents through a pipeline of stages — filter, group, project, lookup, unwind, facet — to produce reports, analytics and reshaped data in a single round-trip.
Understanding the topic
- Each stage takes documents in, emits documents out.
- Stages compose top-down; output of one feeds the next.
- Aggregations can hit indexes and run in parallel across shards.
- Replaces app-side joining, grouping and reporting.
Syntax reference
js
db.orders.aggregate([{ $match: { status: "paid" } },{ $group: { _id: "$userId", total: { $sum: "$amount" } } },{ $sort: { total: -1 } },{ $limit: 10 }]);
Real-world use
Daily revenue rollups, leaderboards, RFM segmentation — all idiomatic aggregations.
Ready to mark this lesson complete?Track your journey across the entire course.