Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardMongoDBAggregation pipeline executionSingle-choice MCQ

In a sharded cluster, this pipeline runs against a collection sharded on { region: 1 }. How does mongos split the work across shards and the merging node, and where does the $group actually compute?

db.sales.aggregate([ { $match: { year: 2025 } }, { $group: { _id: "$product", total: { $sum: "$amount" } } } ])