Articles → MONGODB → Write Concern In MongoDB
Write Concern In MongoDB
Purpose
Syntax
db.[Table_name].insertOne(
{
[inserted_document]
},
{
writeConcern:
{
w:[value],
j=[true/false],
wtimeout=[timeout value]
}
})
- w → request acknowledgment that the write operation has propagated to a specified number of MongoDB instances
- j → request acknowledgment that the write operation has been written to the on-disk journal
- wtimeout → specify a time limit to prevent write operations from blocking indefinitely
Example
Click to Enlarge
Click to Enlarge