C100DBA CRUD Operations Practice Question
When performing a findOne operation, what does MongoDB return if no document matches the query criteria?
⚠ Common exam trap
Candidates often assume that findOne will throw an error if no document is found, leading to improper error handling in their code instead of checking for a null result.
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
✓
null
The findOne method is designed to return a single document or null. Returning null is the standard way for the driver and shell to indicate that the search criteria did not produce a match. This is important for application control flow, as developers must always verify that a document was actually retrieved before attempting to access its fields to avoid null pointer exceptions in their code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
An empty document ({})
Why it's wrong here
Returning an empty document would be misleading, as it might suggest a document exists but has no fields. MongoDB adheres to the standard null return pattern for searches that fail to find a match, which allows for clean boolean checks in the application code during development.
- ✓
null
Why this is correct
In MongoDB, findOne returns the matching document if found, or null if no document satisfies the query. This is the expected behavior and allows developers to easily check the existence of a record using standard conditional logic within their application code, preventing common errors.
- ✗
An error code
Why it's wrong here
A query that returns no results is a valid query execution, not an error. The system does not throw an exception for empty results. Only syntax errors or network connectivity issues trigger actual errors, making null the correct and expected outcome for this specific search scenario.
- ✗
An empty cursor
Why it's wrong here
The findOne method returns a document or null, not a cursor. Cursors are returned by the find() method, which is designed to handle potentially large result sets. findOne is a specific shortcut for retrieving a single record, hence it operates under different return type conventions.
About these practice questions
One of 222 original C100DBA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 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.