nerdexam
MongoDB

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…

Sharding

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)
  • A
    3% (1)
  • B
    91% (31)
  • C
    6% (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): mapReduce does 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 group is 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

#aggregation commands#group command#sharding compatibility

Community Discussion

No community discussion yet for this question.

Full C100DBA Practice