Courseiva
Indexing →mediumMultiple Choice

C100DEV Indexing Practice Question

A logistics application stores shipment records in a collection where each document has a numeric field `weight_kg`. Queries frequently filter on `weight_kg` with a range (e.g., between 50 and 200) and sort by `weight_kg` ascending. You create a standard ascending index on `weight_kg`. Which statement best describes the index's behavior for these queries?

⚠ Common exam trap

The trap here is assuming that an index used for filtering cannot also satisfy a sort on the same field, leading to unnecessary blocking sorts.

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 index can efficiently serve both the range filter and the ascending sort, avoiding an in-memory sort.

A single-field ascending index on a numeric field stores keys in sorted order. When a query filters on a range of that field and sorts ascending on the same field, MongoDB can scan the index range and return results in the requested order. This avoids an expensive blocking sort and leverages the index for both filtering and sorting, making it the optimal choice for such query patterns.

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 index cannot be used for range queries on numeric fields because B-tree indexes are designed for equality matches only.

    Why it's wrong here

    B-tree indexes are well-suited for range queries because they store keys in sorted order, allowing efficient traversal of a range. MongoDB regularly uses indexes for range predicates on numeric fields. The claim that B-tree indexes are only for equality is false; they support both equality and range queries effectively.

  • ✗

    The index can support the range filter but cannot provide sorted results, so a blocking sort will be required.

    Why it's wrong here

    A standard B-tree index stores keys in sorted order. For a single-field index on a numeric field, the index can satisfy both equality/range predicates and a sort on the same field. There is no inherent limitation that prevents the index from providing sorted results for an ascending sort. Thus, a blocking sort is not required when the index order matches the sort direction.

  • ✗

    The index will be used only if the range filter is selective enough; otherwise, MongoDB ignores it and performs a collection scan.

    Why it's wrong here

    MongoDB's query planner may choose a collection scan if the index is not selective, but the index is still eligible and can be used. The planner considers multiple plans and may select the index even for less selective ranges. The statement that the index is ignored solely based on selectivity is too absolute and incorrect.

  • ✓

    The index can efficiently serve both the range filter and the ascending sort, avoiding an in-memory sort.

    Why this is correct

    A single-field ascending index on `weight_kg` maintains keys in ascending order. For a range query on that field and an ascending sort on the same field, MongoDB can traverse the index range in order, returning documents already sorted. This eliminates the need for a blocking sort and improves performance for such queries.

About these practice questions

Courseiva writes every C100DEV question from scratch — 259 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 C100DEV 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 C100DEV exam.