0

I'm trying to do two updates to my collection using Meteor/Mongo. But it seems to only update one of them. I've checked the Mongo docs, it seems to be correct, how come it doesn't register both?

Teams.update(myTeam,
            {$inc: {points: -score}},
            {$pull: {members: myMembers[who]}}
            );
Kelvin Zhao
  • 2,243
  • 3
  • 22
  • 31
  • 1
    possible duplicate of [MongoDB: How to update multiple documents with a single command?](http://stackoverflow.com/questions/1740023/mongodb-how-to-update-multiple-documents-with-a-single-command) – Blakes Seven Sep 01 '15 at 02:51

1 Answers1

1

You're passing your second update command as the third parameter to the update function, instead of passing as another value in the second parameter.

Teams.update(myTeam,
        {$inc: {points: -score},
        $pull: {members: myMembers[who]}}
        );
Brian Shamblen
  • 4,653
  • 1
  • 23
  • 37
  • Icic! Weird, the docs seem to put it that way, or I read it wrongly. =( Anyways, it works great! Thanks Brian! =) – Kelvin Zhao Sep 01 '15 at 03:03