samedi 28 mars 2015

How to find by filed and add amount to another field in mongoose

I have PlayerModel which looks like ( using mongoose/mongo )



var PlayerModel = new Schema({
playerUUID : String,
score : Number
});


and I want to add 20 points to score with playerUUID "1261236237621". How to find and update PlayerModel ? Is possible to update as in sql in one statement ?


Aucun commentaire:

Enregistrer un commentaire