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]
     }
})




AttributeDescription
wRequest acknowledgment that the write operation has propagated to a specified number of MongoDB instances.
jRequest acknowledgment that the write operation has been written to the on-disk journal.
wtimeoutSpecify a time limit to prevent write operations from blocking indefinitely.



Example


Picture showing


Picture showing





Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, November 22, 2023

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250