R
R
Rostyslawn2022-02-18 23:47:15
MongoDB
Rostyslawn, 2022-02-18 23:47:15

How to add a parameter to a number with User.updateOne?

When you need to add 200 User.updateOneto 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

1 answer(s)
R
Rag'n' Code Man, 2022-02-19
@Rostyslawn

https://docs.mongodb.com/manual/reference/operator...

User.updateOne({username: "test"}, { $inc: { balance: 200 }})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question