node.js - Mongoose async queries -
i have site on nodejs-express , when user increment balance:
user.update({steamid: user.steamid}, {$set: {wallet: user.wallet + 1)}}, function(err){ if(err) console.log(err); });
but when user increment "wallet" @ least twice in row mongoose add 1 point in "wallet". should do? maybe add queue array , call async?
you should increment instead of set.
user.update({steamid: user.steamid}, {$inc:{wallet:1}}, function(err){ if(err)console.log(err) });
i use when don't need information model quantity , need difference value operate on model itself.
Comments
Post a Comment