increment column value by 1 in mongodb

questionsCategory: Questionsincrement column value by 1 in mongodb
Pradeep asked 10 months ago

hi i am working with mongo DB, like My SQL to increment a column value how can i perform in mongo DB.
For Example :
i have a collection empdetails having column salary, i want to write querry to increment 10% salry of all employee in single querry

Share this:

Copy and paste this code into your website.

1 Answers
Abhishek Todkar answered 10 months ago

Here is the query you can try:
db.empdetails.update({}, { $mul: { salary: 1.1 } });