Mongo DB 4.0 Transactions With Mongoose & NodeJs, Express
问题 I am developing an application where I am using MongoDB as database with Nodejs + Express in application layer, I have two collections, namely users transactions Here i have to update wallet of thousands of users with some amount and if successful create a new document with related info for each transaction, This is My code : userModel.update({_id : ObjectId(userId)}, {$inc : {wallet : 500}}, function (err, creditInfo) { if(err){ console.log(err); } if(creditInfo.nModified > 0) {