javascript - MongoDB Meteor.js Increment var from a var in another document -


i have this:

i can't seem able modify multiple documents same time.

click: function() {       var power = meteor.user().power;       var mult = meteor.user().mult;       meteor.users.update({                   _id: this.userid               }, {                   $inc: {                       'money': power * mult,                       'lifetimeclick': 1,                       'done': 0,                       'done2': 0,                       'done3': 0,                    }, 

how make changes var of document @ same time. please tell me if there other snippets need see or whether or not unclear you.

i want when click button, increments current user's variables , variable of set user have made.

i have tried many things have no idea format use or how go doing this.

i want function take variable 1 document , add variable in document. thing know how add variables in 1 document.

it sounds expect multiple documents in collection meet query criteria, , want update each of documents? if that's case need set the multi parameter.

db.update( _id: theid, { $inc: { value: 1}}, { multi: true});


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -