C100DBA Sharding Practice Question
A MongoDB 6.0 sharded cluster uses a shard key of { region: 1, customerId: 1 } for a global order collection. Most queries filter on customerId only, without region. The operations team observes that nearly every read is a scatter-gather across all shards. What is the most accurate explanation for this behavior?
⚠ Common exam trap
The trap here is assuming that any field contained in a compound shard key enables targeted reads, when only a leading prefix of the shard key can be used for routing.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The shard key fields are in the wrong order: customerId must precede region so that queries filtering only on customerId can target a subset of shards.
Query targeting on a sharded collection depends on whether the predicate includes a prefix of the shard key. With { region: 1, customerId: 1 }, the leading field is region, so a query filtering only on customerId matches no prefix and mongos broadcasts to all shards. Placing customerId first allows equality queries on customerId to be routed to a single shard, resolving the scatter-gather pattern.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The shard key fields are in the wrong order: customerId must precede region so that queries filtering only on customerId can target a subset of shards.
Why this is correct
MongoDB can target queries using a prefix of the shard key. With customerId as the first field, an equality query on customerId matches the prefix and routes to the owning shard, eliminating scatter-gather. With region first, customerId-only queries do not match the prefix and must be broadcast, so reordering the key addresses the observed behavior.
- ✗
The collection uses hashed sharding, which prevents any targeted reads regardless of which shard key fields appear in the query predicate.
Why it's wrong here
Hashed sharding supports targeted queries when the query includes an equality match on the hashed field, because mongos can compute the hash and route to the correct shard. The scenario describes a compound ranged key, not hashed sharding, and hashed sharding itself is not the cause of the broadcast behavior observed.
- ✗
The balancer is disabled, so chunks for the customerId values are not distributed and queries cannot be routed to a single shard.
Why it's wrong here
The balancer affects chunk distribution and migration, not query routing logic. Even with a perfectly balanced cluster, a query lacking the shard key prefix cannot be targeted because mongos has no mapping to identify the owning shard. Disabling the balancer would not cause or fix the scatter-gather described here.
- ✗
The shard key is compound, and MongoDB cannot route queries unless every field in the shard key is present with an equality match.
Why it's wrong here
A compound shard key does support targeted queries when the query includes a prefix of the shard key, not necessarily every field. For { region: 1, customerId: 1 }, a query on region alone can be targeted. The issue in this scenario is that customerId is not the leading prefix, so an equality-only query on customerId forces a broadcast to all shards.
Visual reference
About these practice questions
This C100DBA question is part of Courseiva's 222-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official MongoDB exam blueprint
This C100DBA practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DBA exam.