I am creating a shopping application. Each user have wallet. Structure is like :
{ \"userName\" : \"Gandalf the Grey\", \"wallet\" : 100, \"orderHi
You can use $inc operator
db.collection('users').updateOne( { 'userName': controller.userName }, { '$inc': { 'wallet': -product.cost } } )