Write Concern
Parent: MongoDB Connection String URI · Published reference · snapshot 2026-10-23 · skill mongodb-cohort-67b8def68c5a
↓ Facts as markdownall context files
Source-anchored research for Write Concern. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
How it works
- If an operation omits an explicit write concern, it inherits the deployment's global default. MongoDB documents `w: "majority"` as the implicit default for most deployments, with a `w: 1` exception for some arbiter topologies; Atlas connection strings enforce `majority` when the URI omits write concern. (medium confidence) (verified as of 2026-10-22) [source]
- The Percona Operator for MongoDB 1.23.1 exposes `defaultRWConcern.writeConcern.w` and `defaultRWConcern.writeConcern.wtimeout` as cluster-wide write concern settings. Its versioned documentation gives `majority` as the default `w` value when this setting is applied. (medium confidence) (verified as of 2026-10-05) [source]
Problems, failure modes and limitations
- If `wtimeout` expires, MongoDB returns a write concern error even if the requested acknowledgment may arrive later. MongoDB does not undo data modifications already completed before the timeout, so the error does not prove that no write occurred. (high confidence) [source]
- The current MongoDB connection string manual marks `wtimeoutMS` deprecated and says `timeoutMS` overrides it. (low confidence) (verified as of 2026-10-22) [source]
- For write concerns above `w: 1`, `wtimeout` limits the wait for enough members after the primary succeeds. A timeout returns a write concern error without undoing successful data modifications, so that error does not prove the write was not applied. (high confidence) [source]
Comparisons and alternatives
- MongoDB Jira SERVER-80363 reported that MongoDB 6.0.9 used `w: 1` when a command supplied `wtimeout` without `w`, instead of combining the timeout with the deployment default. MongoDB lists fixes in 5.0.27, 6.0.15, 7.0.5, and 7.2.1; check the target server version if a URI supplies `wtimeoutMS` without `w`. (medium confidence) (verified as of 2026-09-21) [source]
Facts and statements
- Write concern specifies the acknowledgment requested before MongoDB reports a write as successful. A connection URI can set `w` to a number, `majority`, or a tag set; `journal` requests the `j` journal acknowledgment; and `wtimeoutMS` limits how long MongoDB waits for the requested write concern. (high confidence) [source]
- The URI option `journal=true` requests acknowledgment that the write reached the on-disk journal. If `w` is less than 1, the `journal` option takes precedence. (high confidence) [source]
- Connection-string option names are case-insensitive. If the URI and an insert or update method both specify write concern, the method parameter overrides the URI value. (high confidence) [source]
- MongoDB applies write concern at the transaction level for multi-document transactions, not at individual operation level. Spring Data MongoDB also exposes transaction-level write concern through its `mongo:writeConcern` transaction label. (high confidence) [source]
- The current MongoDB URI reference deprecates `wtimeoutMS` in favor of `timeoutMS` and says `timeoutMS` overrides it. The same reference says `timeoutMS` is not yet supported by all official drivers. (high confidence) (verified as of 2026-10-22) [source]
- Write concern specifies the acknowledgment a write requests. Its `w` field selects a node count or tag rule, `j` requests on-disk journal acknowledgment, and `wtimeout` bounds waiting for the requested write concern. (high confidence) [source]
- MongoDB connection strings expose write concern through `w`, `wtimeoutMS`, and `journal`; the C driver documents the same URI fields. A write concern supplied to an operation method overrides the connection string value. (high confidence) [source]
- By itself, `w: 0` requests no acknowledgment; `w: 1` requests acknowledgment from the standalone or replica set primary; a numeric `w` requests acknowledgment from that many instances; and `w: "majority"` requests acknowledgment from the calculated majority of data-bearing voting members. MongoDB documents majority as the implicit default for most deployments, with some arbiter topologies defaulting to `w: 1`. (high confidence) (verified as of 2026-10-22) [source]
- `journal: true` requests journal acknowledgment from the members selected by `w`, but journaling on the primary alone does not prevent a replica set write from rolling back after failover. (high confidence) [source]
- Higher write concern levels can increase the latency of an individual write; `w: 1` can acknowledge before secondaries replicate and may be rolled back if the primary fails before replication. (high confidence) [source]
- Jepsen’s report describes its MongoDB 3.6.4 testing as finding that write concerns weaker than majority could lose committed writes. This is historical, version-specific test evidence, not a claim about current MongoDB releases. (medium confidence) (verified as of 2020-05-15) [source]
Children
- No children recorded.