Quick revision
The short answer
Write concern w:1 acknowledges a write once the primary has applied it, while w:'majority' waits until a majority of voting members have it. With w:1, if the primary fails before the write reaches a secondary, a new primary is elected without it and the write is rolled back when the old primary rejoins, even though the client was told it succeeded. Read concern 'local' returns the node's latest data, which may include writes that are later rolled back, while 'majority' returns only data acknowledged by a majority, which cannot be rolled back; j:true additionally requires the write to be in the on-disk journal, and since MongoDB 5.0 the default write concern is majority for most deployments, so check your version and settings.
What to remember
In this answer, we saw that w:1 acknowledges a write once the primary has it, while w:'majority' waits for a majority of voting members, and that with w:1 a primary failure before replication causes a rollback of a write the client believed succeeded. Read concern 'local' returns the node's latest data, possibly later rolled back, and 'majority' returns only durable, majority-acknowledged data. j:true requires the journal, and since MongoDB 5.0 the default write concern is majority for most deployments, which we should verify for our own cluster.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Write concern w:1 acknowledges a write once the primary has applied it, while w:'majority' waits until a majority of voting members have it. With w:1, if the primary fails before the write reaches a secondary, a new primary is elected without it and the write is rolled back when the old primary rejoins, even though the client was told it succeeded. Read concern 'local' returns the node's latest data, which may include writes that are later rolled back, while 'majority' returns only data acknowledged by a majority, which cannot be rolled back; j:true additionally requires the write to be in the on-disk journal, and since MongoDB 5.0 the default write concern is majority for most deployments, so check your version and settings.
Why this question is asked
Write and read concerns are the settings that decide what 'saved' and 'read' actually mean in a replicated MongoDB deployment. Most of the time the difference is invisible, and that is exactly the danger: with the wrong settings, a system can lose acknowledged writes during a failover and nobody notices until a customer asks where their order went. Interviewers ask this to see whether we understand replication well enough to explain the failure, not just recite the option names. In this answer, we will recap how a replica set replicates, compare w:1 and w:'majority', walk through the rollback that w:1 allows, compare the read concerns, and finish with journaling and defaults.
1A Quick Recap of Replica Set Replication
A replica set has one primary, which accepts all writes, and secondaries, which copy the primary's operations from its oplog, an ordered log of changes, and apply them in the same order. Replication is asynchronous: the primary does not wait for secondaries before applying a write locally. A typical set has three voting members, so a majority is two.
If the primary fails, the remaining members hold an election and the secondary with the most recent data among those that can win becomes the new primary. The important consequence is that any write the old primary had applied but no secondary had copied yet is not on the new primary.
2W:1 Versus w:'majority'
A write concern tells the server when to acknowledge a write to the client.
With w:1 the client gets its answer after a single node has the write, which is the fastest possible acknowledgement. With w:'majority' the primary waits until enough secondaries report that they have the write, which in a three-member set means one secondary. That adds the time of one replication round trip, typically a millisecond or two in one data centre and more across regions. wtimeout limits how long the client waits; a timeout does not undo the write, it only means the majority was not confirmed in time.
3What Goes Wrong With w:1: The Rollback
Here is the failure in sequence. The client writes with w:1, the primary applies it and acknowledges, and then the primary crashes before any secondary has copied the write.
8 messages in order. Play them, or step through them one at a time.
The client was told the write succeeded, yet the order is no longer in the database.
When A rejoins as a secondary, it compares its oplog with the new primary's and finds operations that the new primary never had. It must undo them to match the set, so it rolls them back and saves the rolled-back documents to rollback files on disk for an operator to inspect. From the application's point of view, order 1001 was acknowledged and then vanished. With w:'majority', the write would have been acknowledged only after B or C had it, and an election always picks a member that has all majority-committed writes, so it could not be lost this way.
4Read Concern 'local' Versus 'majority'
Read concern is the matching setting on the read side: it decides which version of the data a read may return. 'local' returns the most recent data on the node we are reading from, whether or not a majority has it. That is the newest view, but on a primary it can include writes that are later rolled back, like order 1001 above. A reader could see order 1001, act on it, and then find it gone.
'majority' returns only data that a majority of members have acknowledged, which cannot be rolled back. The read may be very slightly behind the latest writes, but whatever it returns is durable. For reads that drive important decisions, such as showing a payment as complete or triggering a shipment, 'majority' together with w:'majority' writes gives a consistent, durable view.
| Setting | Acknowledged or returned when | Risk |
|---|---|---|
| w:1 | primary has applied the write | lost in rollback if primary fails before replication |
| w:'majority' | majority of voting members have it | a little more latency per write |
| j:true | write is in the on-disk journal | more latency; protects against process crash |
| read 'local' | latest data on that node | may return data that is later rolled back |
| read 'majority' | data acknowledged by a majority | may be slightly behind the newest write |
5Journaling and the Defaults
j:true asks the server to acknowledge only after the write is in the journal, MongoDB's on-disk write-ahead log. Without it, a write could be acknowledged while it is still only in memory, and a crash of that process could lose it even before replication is considered. With w:'majority', the default setting writeConcernMajorityJournalDefault makes members journal the write before counting it toward the majority, so majority writes are durable on disk on a majority of members.
Defaults changed over time, which is why older articles disagree. Since MongoDB 5.0 the implicit default write concern is w:'majority' for most replica sets; deployments with arbiters can end up with a default of w:1 depending on how many data-bearing voting members there are. Drivers or connection strings may also set w explicitly. So we check rather than assume: db.adminCommand({getDefaultRWConcern: 1}) shows the cluster defaults, and the connection string or code shows any override.
6Follow-up questions
When is w:1 acceptable?
For data where an occasional loss during failover is acceptable, such as metrics, logs or caches that can be rebuilt, and where the lower latency matters. For orders, payments or anything a user was told is saved, use w:'majority'.
Does read concern 'majority' make reads slower?
Usually only slightly, since the node serves the latest majority-committed snapshot it already tracks. The visible effect is that a read right after a write may not yet include it unless we use a causally consistent session.
What does w:'majority' do if a majority is unavailable?
The write is applied on the primary but cannot be acknowledged, so the client waits until wtimeout expires and gets a write concern error. The write may still become majority-committed later or be rolled back, so the application must treat the outcome as unknown and retry idempotently.
7Conclusion
In this answer, we saw that w:1 acknowledges a write once the primary has it, while w:'majority' waits for a majority of voting members, and that with w:1 a primary failure before replication causes a rollback of a write the client believed succeeded. Read concern 'local' returns the node's latest data, possibly later rolled back, and 'majority' returns only durable, majority-acknowledged data. j:true requires the journal, and since MongoDB 5.0 the default write concern is majority for most deployments, which we should verify for our own cluster.
Open with
Write concern is about when the server tells me a write succeeded. With w one, the primary acknowledges once it has applied the write itself. With w majority, it waits until a majority of voting members have it, so in a three-member set the primary plus one secondary.
Then, if they want more
The risk with w one comes from asynchronous replication. If the primary acknowledges, then crashes before any secondary copied the write, the election picks a secondary that never saw it. When the old primary rejoins, its extra operations don't match the new primary's history, so it rolls them back into rollback files.
The client was told the write succeeded, and it's gone. With majority, an acknowledged write is on a majority, and elections always pick a member that has it, so it survives. Read concern is the same idea for reads. Local returns the latest data on that node, which may include writes that will be rolled back.
Majority returns only majority-acknowledged data, which is durable, though possibly a moment behind. j true additionally requires the write to be in the on-disk journal. Since 5.0 the default write concern is majority for most replica sets, but arbiters or explicit settings can change that, so I check getDefaultRWConcern and the connection string.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- MongoDB manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Explain write concern w:1 vs w:'majority' and read concern 'local' vs 'majority' in a...": https://scrivio-interview-library.netlify.app/databases/mongodb/a3ffc8f6ba/