B. w:2 is invalid; only 0,1, or 'majority' allowed
C. insertOne does not accept writeConcern option
D. The document field 'item' is not allowed
Solution
Step 1: Check writeConcern syntax
wtimeout expects a number (milliseconds), not a string.
Step 2: Validate other parts
w:2 is valid if the replica set has at least 2 nodes; insertOne accepts writeConcern; 'item' field is valid.
Final Answer:
wtimeout must be a number, not a string -> Option A
Quick Check:
wtimeout type must be number [OK]
Hint: wtimeout needs number, not quotes [OK]
Common Mistakes:
Using string for wtimeout
Thinking w:2 is invalid always
Assuming insertOne disallows writeConcern
5. You want to ensure that a write is saved to disk on the primary and replicated to at least two secondary nodes before confirming success. Which write concern setting achieves this?
hard
A. { writeConcern: { w: 1, j: true } }
B. { writeConcern: { w: 3, j: true } }
C. { writeConcern: { w: 'majority', j: false } }
D. { writeConcern: { w: 2, j: false } }
Solution
Step 1: Understand w and j options
w:3 means wait for acknowledgment from primary plus two secondaries (total 3 nodes). j:true means wait for write to be committed to journal (disk) on primary.
Step 2: Check other options
B waits only for primary with journaling; C waits for majority but no journaling; D waits for 2 nodes but no journaling.
Final Answer:
{ writeConcern: { w: 3, j: true } } -> Option B
Quick Check:
w:3 + j:true = 3 nodes + disk write [OK]
Hint: w:number = nodes ack; j:true = disk commit [OK]
Common Mistakes:
Ignoring journaling for durability
Using w:'majority' without knowing node count
Assuming w:2 means two secondaries only
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.