C100DBA Application Administration Practice Question
An application needs to update a user's balance. Which method ensures the operation is atomic for a single document?
⚠ Common exam trap
Many candidates incorrectly choose findAndModify or multi-document transactions when asked for the simplest atomic operation on a single document, missing the efficiency of updateOne with operators.
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
✓
Use the $inc operator with the updateOne method.
Atomic updates are a cornerstone of MongoDB's document model. Using update operators like $inc ensures that the update is performed in a single, atomic step at the document level. This prevents race conditions where two threads might attempt to update the same balance simultaneously, ensuring that data integrity is maintained without the need for manual locking mechanisms in the application layer.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Read the document, update the value in application code, and save the document.
Why it's wrong here
This approach is prone to race conditions, known as a 'lost update.' If two processes read the document simultaneously, they will both modify the same initial state, and the final save will overwrite the other, resulting in inaccurate balance data for the user.
- ✓
Use the $inc operator with the updateOne method.
Why this is correct
The $inc operator performs an atomic increment on the server side. Because it is an atomic operation on a single document, it guarantees consistency even under high concurrency, making it the standard and safest method for updating numeric fields like balances in an application.
- ✗
Wrap the operation in a multi-document transaction every time.
Why it's wrong here
While transactions are valid for atomicity, they introduce significant performance overhead for simple, single-document updates. Using unnecessary transactions consumes system resources and increases latency, which is suboptimal for high-frequency operations that can be handled atomistically by standard update operators.
- ✗
Use a global application-level mutex lock before updating.
Why it's wrong here
Application-level locking is fragile and does not scale across multiple instances of an application. Furthermore, it adds complexity and latency. MongoDB provides atomic operators specifically to avoid this type of external locking, making it the preferred method for maintaining data consistency.
About these practice questions
Courseiva writes every C100DBA question from scratch — 222 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 →
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.