Write concern: acknowledgement and durability
coreadvancedWrite concern controls how many replica set members must confirm a write before MongoDB reports it as successful. A weaker write concern returns faster but risks that acknowledged write later being rolled back if the primary fails before it replicates; a stronger one waits longer but makes that outcome far less likely.
Think of it as
Every write concern level is really answering one question: "if the primary died the instant after this write returned, could the write still be lost?" w: 1 says yes, possibly. w: "majority" says no, because a majority already has it, and a majority is exactly what a new primary election requires — so the new primary is guaranteed to include this write.
What we're doing: Show a write concern choice tied to what the data is worth protecting.
- 2
- w: "majority" with j: true means the payment is acknowledged only once a majority of members have it durably on disk — losing it on a primary failure would require losing a majority at once.
- 7
- A page view is cheap to lose and expensive to slow down at this volume — the default write concern trades some durability risk for much lower latency, which fits data this disposable.
Why this works: The right write concern is a direct function of what the data is worth — the same choice ("majority" for everything, or "1" for everything) is wrong in one direction or the other for a system handling both payments and page-view analytics.
Using the default write concern uniformly across an application with very different data criticality
Wrong
Better
What you see: A financial write is acknowledged, the primary fails moments later before replicating, and the write is gone — the application already told the user it succeeded.
Why: A weaker write concern is a real risk, not a theoretical one — an acknowledged write is not yet safe from a primary failure unless enough members already have it, and "enough" is exactly what write concern controls.
- w: 1
- primary applies the write, acknowledges immediately
- fastest response
- if the primary fails before replicating, the write can be lost on failover
- w: "majority"
- waits for a majority of members to apply it
- higher latency
- safe against single-primary failure — a new primary is elected from that same majority
Remember: Write concern trades latency for the durability of an acknowledged write — w: "majority" is safe against a single primary failure because a new primary is always elected from that same majority.
See also: write concern w j and wtimeout · read write concern in transactions

