C100DEV MongoDB Overview and Document Model Practice Question
A developer is working with a MongoDB collection that stores product data. Each product document has a 'price' field. The developer needs to find all products with a price greater than 100 and less than 200. Which query operator should be used?
⚠ Common exam trap
The trap here is mixing up inclusive and exclusive range operators; $gte/$lte would include the boundaries, which the scenario explicitly excludes.
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
✓
$gt and $lt
To find documents where a field falls within an exclusive range, MongoDB provides the $gt and $lt operators. Combining them in a single query object on the same field applies both conditions. This is a common pattern for range queries and is efficient when an index exists on the field. The other operators either include boundary values or are for different query types.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
$gte and $lte
Why it's wrong here
The $gte (greater than or equal) and $lte (less than or equal) operators would include products with a price of exactly 100 or 200. The requirement is for prices greater than 100 and less than 200, so these operators would incorrectly include boundary values. They are used for inclusive ranges.
- ✗
$and with $gt
Why it's wrong here
Using $and with two separate $gt conditions would be redundant and incorrect for a range. For instance, {price: {$gt: 100, $gt: 200}} would effectively apply only the last condition. The $and operator is used to combine multiple independent conditions, but for a range on the same field, $gt and $lt are combined directly.
- ✗
$in
Why it's wrong here
The $in operator matches any of the values specified in an array. It is used for equality checks against multiple possible values, not for range queries. For example, {price: {$in: [100, 200]}} would match only exactly 100 or 200, not a range.
- ✓
$gt and $lt
Why this is correct
The $gt (greater than) and $lt (less than) operators are used to specify a range condition. By combining them in a query like {price: {$gt: 100, $lt: 200}}, MongoDB returns documents where the price falls strictly between 100 and 200. This is the correct way to express an exclusive range.
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.