Kelvin Zhao
Kelvin Zhao

Reputation: 2415

Collection only updates once?

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]}}
            );

Upvotes: 0

Views: 29

Answers (1)

Brian Shamblen
Brian Shamblen

Reputation: 4703

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]}}
        );

Upvotes: 1

Related Questions