‘Write concern’ in MongoDB describes the level of write acknowledgment you can expect from it. It’s a rather important setting to remember in your write operations and its behavior is useful to understand, especially in distributed MongoDB deployments (i.e. replica sets and sharded clusters). In this post, we discuss 3 gotchas when using MongoDB write concern.
Read the original article: MongoDB Write Concern: 3 Must-Know Caveats
MongoDB Write Concern
MongoDB’s documentation defines write concern as “the level of acknowledgment requested from MongoDB for write operations to a standalone mongod or to replica sets or to sharded clusters.”
Simply put, a write concern is an indication of ‘durability’ passed along with write operations to MongoDB. To clarify, let us look at the syntax:
{ w: <value>, j: <boolean>, wtimeout: <number> }
Where*,
w can be an integer | “majority” | , it represents the number of members that must acknowledge the write. Default value is 1.
j Requests that a write be acknowledged after it is written to the on-disk journal as opposed to just the system memory. Unspecified by default.
wtimeout specifies timeout for the applying the write concern. Unspecified by default.
* You can find the detailed syntax in the Write Concern Specification documentation.
* Learn more about the different …
MOST COMMENTED
News
How Security Tokens Could Change Liquidity and Transform the World’s Economy
News
Social Engineering Attacks by the Numbers: Prevalence, Costs, & Impact
News
How AI is Keeping Us Safe From Drivers Who Use Their Mobile Phones at the Wheel
News
Prospects and Challenges of Applying Big Data in Education
News
The Power of AI in Social Media
News
Using Predictive Analytics to Assess the ROI of a Startup
News
Fighting Back Against Phishing: A Workplace Concern