Courseiva
Sharding →hardMultiple Select

C100DBA Sharding Practice Question

A financial services company runs a sharded MongoDB cluster with three shards. They need to shard a new collection that stores transaction records. The collection will be queried primarily by 'accountId' and 'transactionDate'. The team wants to minimize scatter-gather queries and ensure even data distribution. Which two actions should they take when choosing and implementing the shard key? (Choose two.)

⚠ Common exam trap

The trap here is focusing only on even distribution and ignoring query patterns, leading to choices that cause scatter-gather.

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

✓

Ensure the shard key has high cardinality and low frequency to avoid jumbo chunks and hot spots.

The compound shard key with 'accountId' first supports targeted queries on account and range queries on date, while also providing high cardinality and low frequency. This combination reduces scatter-gather and avoids hot spots. Hashed or random keys improve distribution but break query targeting, and a monotonically increasing key creates write hot spots.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Ensure the shard key has high cardinality and low frequency to avoid jumbo chunks and hot spots.

    Why this is correct

    High cardinality ensures many distinct shard key values, and low frequency means no single value dominates. This prevents large, unsplittable chunks (jumbo chunks) and uneven write distribution. For transaction records, 'accountId' combined with 'transactionDate' can provide high cardinality and low frequency if accounts are numerous and transactions are spread over time.

  • ✓

    Use a compound shard key with 'accountId' as the first field and 'transactionDate' as the second field to support queries that include both fields.

    Why this is correct

    A compound shard key with 'accountId' first allows targeted queries when the query includes 'accountId', and adding 'transactionDate' as a suffix supports range queries on date within an account. This reduces scatter-gather for common query patterns and provides good cardinality if 'accountId' has many distinct values.

  • ✗

    Choose a shard key that is monotonically increasing, such as an auto-incrementing transaction ID, to simplify range queries.

    Why it's wrong here

    A monotonically increasing shard key causes all new inserts to target the same chunk, creating a hot spot on one shard. This leads to write bottlenecks and uneven distribution. While range queries on the ID are efficient, the write scalability suffers, which is unacceptable for a high-throughput transaction collection.

  • ✗

    Use a random shard key generated by the application to guarantee even distribution across shards.

    Why it's wrong here

    A random shard key can distribute writes evenly, but it prevents targeted queries because the application cannot predict which shard holds a given account's transactions. Queries by 'accountId' would become scatter-gather across all shards, which contradicts the requirement to minimize such queries and support efficient access by account.

  • ✗

    Use a hashed shard key on 'accountId' to ensure even distribution, even though it prevents efficient range queries on 'transactionDate'.

    Why it's wrong here

    Hashed sharding on 'accountId' distributes data evenly but sacrifices the ability to perform targeted range queries on 'transactionDate' because hashing destroys order. Queries that filter on both fields would still need to target all shards for the date range, causing scatter-gather and defeating the goal of minimizing such queries.

About these practice questions

Courseiva writes every C100DBA question from scratch — 222 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.