Courseiva
CRUD Operations →easyMultiple Choice

C100DBA CRUD Operations Practice Question

A DBA is reviewing a slow query on the `orders` collection. The query is: `db.orders.find( { status: "shipped", total: { $gt: 100 } } )`. The collection has an index on `{ status: 1, total: 1 }`. Which statement best describes how MongoDB will use this index to satisfy the query?

⚠ Common exam trap

The trap here is believing that range conditions cannot leverage indexes or that a sort is required for index usage.

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 will be used to filter both `status` and `total` because the index prefix matches the equality condition and the range condition.

A compound index with an equality field followed by a range field is ideal for queries that filter on both. MongoDB will use the index to seek to the equality value and then scan the range on the second field. This minimizes document examinations and is the expected behavior for the given index and query.

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 will only be used for `status`, and `total` will be filtered in memory because range conditions cannot use an index.

    Why it's wrong here

    Range conditions can use an index, especially when they appear after equality fields in a compound index. MongoDB will use the index for both fields in this case, scanning the index range for `total` values greater than 100 within the matching `status` entries. The statement that range conditions cannot use an index is incorrect.

  • ✗

    The index will be used, but only if the query includes a sort on `total` to enforce index order.

    Why it's wrong here

    A sort is not required for the index to be used for filtering. The index can be used to satisfy the query predicates regardless of whether a sort is present. Adding a sort might affect whether the index also provides sorted results, but it is not a prerequisite for index usage.

  • ✗

    The index will not be used because the query includes a range condition on `total`.

    Why it's wrong here

    MongoDB can use indexes for range queries. In fact, compound indexes are designed to support equality on prefix fields and range on subsequent fields. The presence of a range condition does not prevent index usage; it merely defines the scan range within the index.

  • ✓

    The index will be used to filter both `status` and `total` because the index prefix matches the equality condition and the range condition.

    Why this is correct

    The compound index `{ status: 1, total: 1 }` has an equality field first and a range field second. MongoDB can use the index to match `status: "shipped"` exactly and then scan the index for `total > 100` within that status. This is the optimal use of a compound index for this query pattern.

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.