C100DBA Application Administration Practice Question
A development team is building a Node.js application that connects to a MongoDB replica set. They want the driver to automatically retry certain write operations once if they fail due to a transient network error, without requiring custom retry logic in their code. Which connection string option should they enable?
⚠ Common exam trap
A common mix-up: candidates confuse write concern settings like w=majority with automatic retry behavior; w=majority ensures durability but does not make the driver retry failed writes.
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
✓
retryWrites=true
The retryWrites=true connection string option instructs the MongoDB driver to automatically retry supported write operations once if they fail with a retryable error. This offloads retry logic from the application code and is the standard way to handle transient network issues in replica sets. Other options affect write concern, read routing, or connection timeouts, but none provide automatic write retries.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
w=majority
Why it's wrong here
The w=majority write concern specifies that a write must be acknowledged by a majority of replica set members before returning success. It improves durability but does not cause the driver to retry failed writes automatically; the application would still need to handle transient errors manually.
- ✓
retryWrites=true
Why this is correct
Setting retryWrites=true in the connection string enables the driver to automatically retry supported write operations exactly once if they encounter a retryable error, such as a network blip. This meets the team's requirement without custom code and is supported by MongoDB drivers for replica sets and sharded clusters.
- ✗
readPreference=primaryPreferred
Why it's wrong here
readPreference=primaryPreferred directs read operations to the primary if available, otherwise to a secondary. This affects read routing only and has no impact on write retry behavior; it does not satisfy the requirement for automatic write retries.
- ✗
connectTimeoutMS=30000
Why it's wrong here
connectTimeoutMS sets how long the driver waits to establish a connection before timing out. While it can influence connection resilience, it does not enable automatic retries of write operations; the application would still fail on transient errors unless retry logic is added.
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.