Courseiva

C100DEV MongoDB Overview and Document Model Practice Question

A developer is working with a MongoDB collection that stores product data. The collection has documents with a field 'price' that is sometimes stored as a double and sometimes as a string, due to inconsistent data entry. A query is run to find all products with a price greater than 100. What is the expected behavior of this query?

⚠ Common exam trap

The trap here is assuming that MongoDB will coerce types or compare across types, but it strictly adheres to BSON type bracketing for queries.

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 query will return only documents where 'price' is a double greater than 100.

MongoDB uses type bracketing for comparison operators: only values of the same BSON type as the operand are considered. Since 100 is a double, only double prices greater than 100 are returned. Strings are not converted, and no error occurs. This underscores the importance of consistent data types in a collection.

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 query will return only documents where 'price' is a double greater than 100.

    Why this is correct

    MongoDB queries enforce type bracketing: comparison operators like $gt only match values of the same BSON type as the query operand. Since 100 is a double, only double values are compared; string values are not converted and thus excluded. This behavior ensures consistent comparisons but can lead to unexpected results if data types are mixed.

  • ✗

    The query will return an error because of the mixed data types in the 'price' field.

    Why it's wrong here

    MongoDB does not error on mixed data types; it simply applies type bracketing during query evaluation. Documents with string prices are skipped for numeric comparisons. This design allows collections to hold polymorphic data without query failures, but developers must ensure data types align with query expectations to avoid missing documents.

  • ✗

    The query will return documents where 'price' is a string greater than '100' lexicographically, as well as doubles greater than 100.

    Why it's wrong here

    MongoDB does not perform lexicographical comparisons for numeric operands. When the query uses the number 100, only numeric BSON types are compared. Strings are not coerced into numbers, nor are they compared lexicographically against a numeric operand. Thus, string prices are not matched, and the query results are limited to double values.

  • ✗

    The query will return all documents where 'price' is greater than 100, regardless of whether it is a double or string.

    Why it's wrong here

    MongoDB does not perform implicit type conversion for comparison operators. A string like '150' is not considered greater than the number 100; they are different BSON types. The query will only match documents where the field is a double greater than 100. This strict type handling prevents ambiguous comparisons but requires consistent data types.

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.