Courseiva

C100DEV MongoDB Overview and Document Model Practice Question

A financial application stores transaction documents in a MongoDB collection. Each document includes fields such as 'transactionId', 'amount', 'currency', and 'timestamp'. The application requires that the 'amount' field always be present and be a double, and that 'currency' be one of a predefined list of ISO codes. Which MongoDB feature should the developer use to enforce these requirements at the database level?

⚠ Common exam trap

The trap here is assuming that application-level validation or indexes can enforce complex data integrity rules, when only database-level schema validation provides that guarantee.

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

✓

Schema validation using JSON Schema with $jsonSchema operator.

Schema validation with $jsonSchema allows developers to specify required fields, BSON types, and allowed values, enforcing data integrity directly in MongoDB. This is ideal for ensuring that 'amount' is always a double and 'currency' is from a predefined list. Other options either provide weaker guarantees or are unrelated to validation.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Application-level validation using Mongoose schema definitions.

    Why it's wrong here

    Mongoose provides application-level validation, but it is not enforced at the database level. If data is inserted through other means, such as the MongoDB shell or another application, these validations are bypassed. The requirement is for database-level enforcement, so this option is insufficient.

  • ✗

    Unique indexes on the 'amount' and 'currency' fields.

    Why it's wrong here

    Unique indexes prevent duplicate values but do not enforce data type or required presence. They cannot ensure that 'amount' is a double or that 'currency' is from a predefined list. Thus, they do not meet the validation requirements described in the scenario.

  • ✗

    Sharding the collection on the 'currency' field.

    Why it's wrong here

    Sharding is a scaling technique for distributing data across multiple servers. It does not enforce data validation rules such as required fields or type constraints. Therefore, it is irrelevant to the requirement of ensuring data integrity for 'amount' and 'currency'.

  • ✓

    Schema validation using JSON Schema with $jsonSchema operator.

    Why this is correct

    MongoDB supports schema validation through the $jsonSchema operator, which allows defining rules such as required fields, BSON type constraints, and enum values. This enforces the requirements at the database level, ensuring data integrity regardless of the application layer, making it the correct choice.

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.