Aggregation for reporting dashboards
📖 Scenario: You work for an online store that wants to create a simple sales report dashboard. The dashboard will show total sales and the number of orders per product category.
🎯 Goal: Build a MongoDB aggregation pipeline step-by-step to calculate total sales and order counts grouped by product category.
📋 What You'll Learn
Create a
sales collection with sample sales documentsAdd a filter stage to select sales from the last month
Group sales by
category to calculate total sales amount and order countSort the results by total sales in descending order
💡 Why This Matters
🌍 Real World
Aggregation pipelines are used in real dashboards to summarize and analyze sales data quickly.
💼 Career
Understanding aggregation is essential for data analysts and backend developers working with MongoDB to build reports.
Progress0 / 4 steps