content_image/810767.jpg
## Write Concern Reference 

Write concern (page 78) describes the guarantee that MongoDB provides when reporting on the success of a write operation. 

Changed in version 2.6: A new protocol for write operations (page 852) integrates write concerns with the write oper- ations and eliminates the need to call the getLastError command. Previous versions required a getLastError command immediately after a write operation to specify the write concern. 

## Available Write Concern 

Write concern can include the w (page 130) option to specify the required number of acknowledgments before return- ing, the j (page 130) option to require writes to the journal before returning, and wtimeout (page 131) option to specify a time limit to prevent write operations from blocking indefinitely. 

In sharded clusters, mongos instances will pass the write concern on to the shard. 

w Option The w option provides the ability to disable write concern entirely as well as specify the write concern for replica sets . 

MongoDB uses w: 1 as the default write concern. w: 1 provides basic receipt acknowledgment. 

The w option accepts the following values: 

<img src='content_image/810767.jpg'>

j Option The j option confirms that the mongod instance has written the data to the on-disk journal. This ensures that data is not lost if the mongod instance shuts down unexpectedly. Set to true to enable. 

