Articles → MONGODB → $Inc Operator In Mongodb

$Inc Operator In Mongodb






Purpose





Example




Picture showing the sample document collection




db.Employees.updateOne({name:'Employee 1'}, {$inc:{age:1}})


Picture showing increasing the value of age to 1 using the $inc operator



Output


Picture showing the value of age after increment





Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, March 19, 2024

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250