C100DBA · Question #82
Which of the following aggregation commands in MongoDB does not support sharded collections?
The correct answer is B. group. group is the command that does not support sharded collections - attempting to run it on a sharded collection throws an error. This is a known limitation of the legacy group command, which predates MongoDB's more mature distributed execution capabilities. Why the distractors…
Question
Which of the following aggregation commands in MongoDB does not support sharded collections?
Options
- AmapReduce
- Bgroup
- Caggregate
- DAll of the above
How the community answered
(34 responses)- A3% (1)
- B91% (31)
- C6% (2)
Explanation
group is the command that does not support sharded collections - attempting to run it on a sharded collection throws an error. This is a known limitation of the legacy group command, which predates MongoDB's more mature distributed execution capabilities.
Why the distractors are wrong:
- A (mapReduce):
mapReducedoes support sharded collections - MongoDB can run the map phase across shards and merge results. - C (aggregate): The aggregation pipeline fully supports sharded collections, distributing pipeline stages across shards efficiently.
- D (All of the above): Incorrect because only
groupis unsupported on sharded collections.
Memory tip: Think "group can't handle the crowd" - just as a group command might struggle in a large crowd, MongoDB's group command can't handle data spread across multiple shards. If you need grouping on sharded data, use the aggregation pipeline's $group stage instead.
Topics
Community Discussion
No community discussion yet for this question.