Courseiva
Indexing and Performance →hardMultiple Select

C100DBA Indexing and Performance Practice Question

Which TWO of the following scenarios are best handled by a Hashed Index?

⚠ Common exam trap

Candidates incorrectly assume hashed indexes support range queries like greater than or less than, leading to poor query optimization and missing results.

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

✓

Sharding a collection on a high-cardinality key.

Hashed indexes map the hash of the field value to the document, which is excellent for distributing data evenly across shards. They are ideal for fields with high cardinality that are primarily used for equality lookups. They do not support range-based queries, so they should not be used for fields where inequality filtering (like greater than or less than) is the primary query 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.

  • ✗

    Range-based queries on numeric fields.

    Why it's wrong here

    Hashed indexes are completely ineffective for range queries because the hash function loses the natural order of the data. Values that are numerically close in the collection will be mapped to entirely different hash buckets, making it impossible to perform efficient range scans using a hashed index.

  • ✓

    Sharding a collection on a high-cardinality key.

    Why this is correct

    Hashed indexes are the industry standard for sharding keys to ensure an even distribution of data across shards. By hashing the shard key, you prevent the 'hot shard' problem, ensuring that writes are spread out across all nodes in the cluster, which is vital for scalability.

  • ✓

    Equality lookups on unique values.

    Why this is correct

    Hashed indexes are very performant for single-value equality lookups. Since the hash value maps directly to the location of the document, the lookup is highly efficient. This makes them an excellent choice for fields used to fetch individual records frequently, provided range queries are not needed.

  • ✗

    Sorting results by the indexed field.

    Why it's wrong here

    Because hashed indexes scramble the order of the values, they cannot be used to satisfy sort requirements. If a query requires a sort on a hashed field, MongoDB will have to perform an in-memory sort or use a different index, resulting in performance overhead.

  • ✗

    Text search on long strings.

    Why it's wrong here

    Text searching requires specialized text indexes that support tokenization and linguistic analysis. Hashed indexes simply hash the entire string, which would only support exact equality matching on the entire field content, not the complex sub-string or keyword searching required for typical text-based document searches.

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.