Courseiva

C100DEV Drivers, Tools, Transactions, and Search Practice Question

A developer is building an application that uses the MongoDB Node.js driver to perform a multi-document transaction. The transaction includes an update to an 'inventory' collection and an insert into an 'orders' collection. During testing, the developer notices that occasionally the transaction aborts with a TransientTransactionError. What is the most appropriate way to handle this error in the application code?

⚠ Common exam trap

The trap here is thinking that any error during a transaction requires aborting and reporting to the user, when in fact transient errors are specifically designed to be retried automatically.

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

✓

Immediately retry the entire transaction from the beginning.

TransientTransactionError is a label indicating a temporary failure that may be resolved by retrying the transaction. The correct approach is to retry the entire transaction, often using the driver's built-in retry mechanism like withTransaction. Aborting without retry, committing despite the error, or restarting the server are all inappropriate responses that could lead to data inconsistency or unnecessary failures.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Restart the MongoDB server to clear the error condition.

    Why it's wrong here

    Restarting the server is an extreme measure that would disrupt all clients and is not a solution for a transient transaction error. Such errors are typically caused by concurrent operations or temporary network issues, not server-wide problems. Restarting would not address the root cause and would cause unnecessary downtime.

  • ✗

    Commit the transaction and ignore the error, as the changes may have been applied.

    Why it's wrong here

    Committing after a TransientTransactionError is dangerous because the transaction may not have completed successfully, and committing could apply partial changes or fail again. The error indicates the transaction did not complete as expected. Ignoring it could lead to data inconsistency and violate ACID guarantees.

  • ✓

    Immediately retry the entire transaction from the beginning.

    Why this is correct

    TransientTransactionError indicates a temporary issue like a write conflict or network glitch. The recommended practice is to retry the entire transaction, as the error label suggests it may succeed on retry. The driver provides a withTransaction helper that automatically retries on TransientTransactionError, but if implementing manually, the application should catch the error and retry the whole transaction logic.

  • ✗

    Abort the transaction and return an error to the user without retrying.

    Why it's wrong here

    Aborting without retry would cause unnecessary failures for transient issues that could be resolved by a simple retry. TransientTransactionError is specifically designed to signal that the operation can be retried. Returning an error to the user would degrade the user experience and may not be necessary if the retry succeeds.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

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.