C100DEV MongoDB Overview and Document Model Practice Question
A financial application stores transactions in a MongoDB collection. Each transaction document includes a 'timestamp' field. The application needs to query transactions for a specific day, and the queries must be efficient. Which indexing strategy is most appropriate?
⚠ Common exam trap
The trap here is assuming that any index on the timestamp field will work, but hashed indexes do not support range queries, and text indexes are for strings, not dates.
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
✓
Create a single-field index on the 'timestamp' field
For efficient range queries on a single field, a single-field index is the correct choice. It allows MongoDB to quickly find documents with timestamps within the desired range. Compound indexes can also work but are unnecessary here, and other index types like text or hashed do not support range queries on dates. The single-field index provides the best balance of performance and simplicity.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Create a hashed index on the 'timestamp' field
Why it's wrong here
Hashed indexes support equality queries by hashing the field value, but they do not support range queries because the hash destroys the ordering of values. Since the application needs to query a range (a specific day), a hashed index would not be usable for that query pattern.
- ✗
Create a compound index on {timestamp: 1, _id: 1}
Why it's wrong here
A compound index on timestamp and _id can support queries on timestamp alone, but the additional _id field is unnecessary if queries only filter by timestamp. It would consume more space and slightly slow writes without providing extra benefit for the stated queries. A single-field index is sufficient and more efficient.
- ✗
Create a text index on the 'timestamp' field
Why it's wrong here
Text indexes are designed for string content and support text search with stemming and tokenization. They cannot efficiently handle range queries on date values. Using a text index on a date field would not support the day-range query and would be inappropriate for the data type.
- ✓
Create a single-field index on the 'timestamp' field
Why this is correct
A single-field index on 'timestamp' allows MongoDB to efficiently locate documents within a date range, such as a specific day. Since the query filters on timestamp, this index directly supports the query pattern, reducing the number of documents scanned. It is the most straightforward and effective solution for range queries on a single field.
About these practice questions
This C100DEV question is part of Courseiva's 259-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 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.