October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

MongoDB w:1 vs w:majority: Write Concern, Latency, and Data-Loss Risk

MongoDB w:1 acknowledges on the primary; w:"majority" waits for a calculated majority. Learn how journaling, failover, and timeouts change the trade-off.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In a MongoDB replica set, w:1 returns an acknowledgment after the primary applies a write; w:"majority" waits until a calculated majority of data-bearing voting members acknowledge it. The trade-off is lower acknowledgment latency with w:1 versus stronger protection against rollback with majority write concern—assuming voting members have journaling enabled and the deployment uses the standard majority-journal setting.

What write concern controls

Write concern sets the acknowledgment threshold a write must meet before MongoDB reports success to the client. It does not determine what a later read will return: write concern is not read concern, and acknowledgment alone does not make every reader immediately see the newest value.

As an Amazon Associate I earn from qualifying purchases.

In a replica set, w:1 asks for acknowledgment from the primary only. w:"majority" asks for acknowledgment from a calculated majority of voting members that store data. The required count depends on the replica-set voting configuration; it is not necessarily every configured member or one fixed number. Arbiters do not store data and are not data-bearing members in this acknowledgment description. MongoDB’s replica-set write concern documentation explains these thresholds.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the two settings compare

Question w:1 w:"majority"
What must acknowledge? The primary. A calculated majority of data-bearing voting members.
What happens if the primary fails before replication? An acknowledged write may be rolled back if it had not reached a secondary. The write has propagated to a majority; with journaling enabled on voting members, MongoDB documents this as the rollback-prevention approach.
What does acknowledgment wait for? With numeric w:1 and j unspecified, acknowledgment follows application in memory; it does not wait for secondary acknowledgment. It waits for the majority threshold. With the standard majority-journal default, it also waits for on-disk journal persistence.
Latency direction Does not wait for secondary acknowledgment. Waiting for replication and journal work can add latency; the amount depends on the system.

MongoDB’s documentation states: “A write concern of w: 1 only requires acknowledgment from the primary replica set member before returning write concern acknowledgment.” MongoDB Manual v8.0.

When an acknowledged write can be rolled back

With w:1, the primary can acknowledge a write before any secondary has replicated it. If the primary then steps down or fails, a new primary may not have that write, and MongoDB may roll it back. This is a risk, not a certainty: a primary failure does not mean every recently acknowledged w:1 write is lost. MongoDB describes rollback behavior during failover in its write concern documentation and its replica-set rollback guidance.

MongoDB’s documented way to prevent rollback of acknowledged data is to run all voting members with journaling enabled and use { w: "majority" }. In MongoDB’s words, that combination ensures writes propagate to a majority before acknowledgment is returned. Majority therefore substantially reduces the risk of losing an acknowledged write in the documented failover case; it is not a promise against every conceivable failure or a replacement for backups and recovery planning.

Why journaling changes the durability claim

By default, writeConcernMajorityJournalDefault is true, so majority acknowledgment waits for journal persistence. If an administrator sets writeConcernMajorityJournalDefault: false, majority writes do not receive that same journal-persistence protection, and MongoDB says they can roll back after a transient loss of a majority of nodes. The setting and journaling configuration therefore matter when evaluating durability, not just the value of w.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For numeric w:1, j:true requests acknowledgment that the write has reached the journal. That is distinct from waiting for replication to other members. See MongoDB’s write concern reference for the interaction of w and j.

Does majority write concern add latency?

It can. A primary-only acknowledgment does not wait for a secondary, while a majority acknowledgment can wait for replication to the members needed to satisfy the threshold and for journal work under the standard default. A lagging or unavailable secondary can delay that acknowledgment and create performance issues in some configurations. MongoDB does not give a universal millisecond or percentage penalty: latency depends on topology, network, storage, write workload, and timeout settings.

Measure on the target deployment and workload rather than applying a generic estimate. Include normal operation and relevant degraded conditions, such as a lagging member, because the threshold may be slower to satisfy then. Streaming replication can reduce latency for writes that wait for replication, but it does not establish a topology-independent latency figure. MongoDB describes replication in its replica set data synchronization documentation.

What a timeout means—and how to handle it

If a write does not meet its requested acknowledgment threshold before the client receives a timeout or write-concern error, that response does not prove the operation was never applied. MongoDB says a write that misses the majority threshold before response may later replicate or roll back. Treat the outcome as uncertain until the application reconciles it; do not blindly retry a non-idempotent operation on the assumption that the first attempt did nothing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use an idempotent operation or a stable application-level operation identifier where possible.
  • When an operation is not safely repeatable, check the resulting state or reconcile through application-specific logic before retrying.
  • Choose client and write-concern timeouts with the deployment’s failover and latency behavior in mind.

MongoDB’s write concern reference discusses timeout behavior at the write concern documentation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check the effective default for your deployment

MongoDB Manual v8.0 says w:"majority" is the default for most replica-set configurations. MongoDB’s rollback guidance describes that default as applying to most deployments starting in MongoDB 5.0, and Atlas documents majority as its default. These qualifications matter: deployment configuration can affect the effective default, so check the setting and topology instead of assuming every cluster behaves identically. See the MongoDB Manual v8.0 replica-set write concern page, MongoDB’s rollback guidance, and Atlas rollback guidance.

Write concern does not control what a read sees

A majority write acknowledgment is not a guarantee that every subsequent read, from every node or with every read preference, returns the newest value. For causal consistency guarantees in a session, MongoDB calls for both majority write concern and majority read concern. The combination matters: write concern governs acknowledgment of writes, while read concern governs the guarantees attached to reads. See MongoDB’s causal consistency documentation.

Which should you choose?

  • Choose w:"majority" when the application should not treat a write as successful until a majority has acknowledged it, and the deployment’s journaling configuration matches the durability assumptions. This is generally the safer choice when losing a recently acknowledged write would be unacceptable.
  • Choose w:1 only when primary-only acknowledgment is an intentional latency trade-off and the application can tolerate or recover from a recently acknowledged write being rolled back after failover.
  • Do not treat every higher numeric w as equivalent to majority. Numeric values greater than one specify a count and can include non-voting data-bearing members; w:"majority" is based on voting members. Their acknowledgment and durability semantics are not interchangeable. MongoDB details numeric write concern in its write concern reference.

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.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.