Set a cluster-wide MongoDB write concern with setDefaultRWConcern, then verify it with getDefaultRWConcern. Journaling is a separate durability behavior: on current MongoDB releases, you generally do not enable or disable journaling with a configuration switch. The usual implicit write concern is w: "majority", but an arbiter topology can make it { w: 1 }.
What MongoDB uses by default
MongoDB’s implicit default write concern is generally w: "majority", meaning the write waits for acknowledgment from a calculated majority of voting members. There is an important exception: if the replica set has at least one arbiter and the number of non-arbiter voting members is not greater than the voting majority, the implicit value is { w: 1 }. MongoDB’s defaults reference illustrates the exception with two non-arbiters plus one arbiter; four non-arbiters plus one arbiter yields { w: "majority" }. See MongoDB’s default read and write concern reference.
As an Amazon Associate I earn from qualifying purchases.
That implicit value is not necessarily the value your application uses. A configured global default applies only to operations that do not specify their own write concern. Drivers can set concerns at client, database, collection, or operation scope, with more specific scopes taking precedence. For a transaction, the transaction-level write concern controls commit; operation-, collection-, and database-level concerns do not apply. See MongoDB’s write concern documentation.
Set a cluster-wide write concern
Run setDefaultRWConcern on the primary for a replica set, or through mongos for a sharded cluster. In a sharded deployment, the global default is stored through the config server replica set; it is not a setting to configure separately on every shard.
#1 Best Overall
- Connect to the right endpoint. Use the replica-set primary, or connect to
mongosfor a sharded cluster. - Set the default. For example, this sets majority acknowledgment as the default and asks the command itself to wait for majority acknowledgment:
db.adminCommand({ setDefaultRWConcern: 1, defaultWriteConcern: { w: "majority" }, writeConcern: { w: "majority" } }) - Check version compatibility. The command requires feature compatibility version (FCV) 4.4 or later. Starting in MongoDB 5.0, after a cluster-wide write concern is set, the command cannot unset it. Review the consequences before applying a cluster-wide value. See the
setDefaultRWConcerncommand reference.
defaultWriteConcern must include a w field and cannot use w: 0. If you omit wtimeout, its value is 0, so the operation can wait indefinitely for the requested acknowledgment level. If you choose a timeout, set it for the deployment’s replication and availability needs: a timeout means the requested acknowledgment was not reached within the limit, not that MongoDB undid work already performed on the primary.
Verify the stored default
Run this administrative command against the deployment endpoint:
db.adminCommand({ getDefaultRWConcern: 1 })
Inspect defaultWriteConcern and defaultWriteConcernSource. A source of implicit means MongoDB supplied the implicit value; global means a cluster-wide default was configured. After an update, secondaries and individual mongos instances may briefly return or use cached values. Allow time for propagation and query the endpoint whose behavior you are checking. See the getDefaultRWConcern command reference and the global-default command documentation.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchUnderstand the difference between w and j
w specifies how many replica-set members must acknowledge a write; j specifies whether eligible acknowledgments wait for journal persistence rather than just in-memory application. They answer different questions and are not interchangeable. MongoDB documents the options in its write concern reference.
Rank #3
| Setting | What acknowledgment means | Durability and trade-off |
|---|---|---|
{ w: 1 } |
The primary acknowledges the write. | With numeric w and no j specified, acknowledgment can follow in-memory application rather than journal persistence. |
{ w: "majority" } |
A calculated majority of voting members acknowledges the write. | When j is omitted, writeConcernMajorityJournalDefault controls journal waiting; it defaults to true. |
{ w: 1, j: true } |
The primary acknowledges after journal persistence. | Requests journal persistence on the primary, but does not by itself require acknowledgment from other members. |
For majority writes with j omitted, writeConcernMajorityJournalDefault: true requires journal persistence, equivalent to j: true. If that setting is false, a majority write can be acknowledged after in-memory application instead. MongoDB warns that this can expose acknowledged writes to rollback after a transient loss of a majority of nodes, such as a crash and restart. See MongoDB’s write concern reference and the writeConcernMajorityJournalDefault parameter reference.
Majority acknowledgment can take longer or fail to complete while enough members are unavailable. Topology matters: if the number of data-bearing voting members is only the calculated majority, losing one may leave the set unable to satisfy a majority write. A configured wtimeout reports that the requested acknowledgment was not achieved in time; it does not reverse the primary’s modification.
Rank #4
Do not use the removed journal on/off options
Journaling helps MongoDB recover writes recorded in the journal but not yet reflected in data files after an unexpected process exit. MongoDB removed storage.journal.enabled and the --journal / --nojournal command-line options starting in MongoDB 6.1. Do not use those obsolete controls when configuring a current release. See the journal configuration reference.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →If you need to adjust journal timing, storage.journal.commitIntervalMs is the journal commit interval setting for mongod. It is distinct from storage.syncPeriodSecs, which is not a journaling control. See the commitIntervalMs option and the syncPeriodSecs option.
Quick Recap
Best Value
Before changing the default
- Confirm the MongoDB version and FCV support the command.
- Count voting and data-bearing members, including any arbiters, to understand the implicit default and majority availability.
- Check client, database, collection, operation, and transaction settings for explicit concerns that override the global default.
- Choose whether your priority is primary-only acknowledgment, majority acknowledgment, or explicit journal persistence, and account for the latency and availability consequences.
- If setting a timeout, remember that a write concern timeout does not roll back a write already made on the primary.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




