Skip to main content
InterviewHubPRO
Section Overview
Q15

Question 15 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

30%
MongoDB & NoSQL (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What is Write Concern (`w`, `j`, `wtimeout`)?

senior LevelSystem Design

In Simple Words: Write Concern describes the level of acknowledgment requested from MongoDB for a write:

  • w: 1 (Default): Acknowledges write as soon as the Primary node in memory commits the write. Risk: If primary crashes before replicating, write is lost.
  • w: "majority": Acknowledges write only after a strict majority of replica set nodes have committed the write to their memory. Eliminates rollback on failover!
  • j: true (Journaled): Requires write to be written to the on-disk Journal before acknowledging.
  • wtimeout: Maximum milliseconds to wait for replica acknowledgment before aborting.