Articles → MONGODB → $Inc Operator In Mongodb$Inc Operator In MongodbIn this article, we will discuss the $inc operator in MongoDB.Purpose The $inc operator is used to increment the value of a field in a document by a specified amount.Example Consider the following collection: -We are required to increment the value of age to 1. For that, we will use the following query: -db.Employees.updateOne({name:'Employee 1'}, {$inc:{age:1}})Output Posted By - Karan Gupta Posted On - Tuesday, March 19, 2024 Query/Feedback Your Email Id Subject Query/Feedback Characters remaining 250
db.Employees.updateOne({name:'Employee 1'}, {$inc:{age:1}})
Query/Feedback