Answer the question
In order to leave comments, you need to log in
How to add a parameter to a number with User.updateOne?
When you need to add 200 User.updateOne
to the fieldbalance
User.updateOne({ username: "test" }, { balance: /* ? */}, (err) => { if(err) console.log(err) })
Answer the question
In order to leave comments, you need to log in
https://docs.mongodb.com/manual/reference/operator...
User.updateOne({username: "test"}, { $inc: { balance: 200 }})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question