Whenever we query the database to insert()
, insertOne()
or insertMany()
, we can pass an additional parameter which is writeConcern
. It is a document describes the level of acknowledgement requested from MongoDB for write operations. Write concern can include the following fields:
- the
w
option to request acknowledgement that the write operation has propagated to a specified number of mongod instances or to mongod
instances with specified tags. - the
j
option to request acknowledgement that the write operation has been written to the journal, and - the
wtimeout
option to specify a time limit to prevent write operations from blocking indefinitely.