Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardMongoDBmongos query routingSingle-choice MCQ

Consider this aggregation against a sharded collection where 'region' is NOT the shard key but 'userId' IS. Predict where the $group runs and why mongos cannot fully push it down.

db.events.aggregate([ { $match: { type: "click" } }, { $group: { _id: "$region", total: { $sum: "$amount" } } } ]) // Shard key is { userId: 1 }; collection is sharded across 3 shards.