Set a value with mongoose in NodeJS

I have a NodeJS application that communicates with an Angular app. This is a simplified version, but I'll try to explain my problem:

I will get a value from the socket connection, for example:

{
    Id : "1", 
    Checked : true, 
    TeamName : "Team1"
}

I want to update the mongoDb with mongoose so that every person with the TeamName : "Team1" gets the value Checked : true.

I have done something like this:

relayModel.find({TeamName : 'Team1'}, 
     {'$set' :{Checked: true}},function(err,docs){
                    if(err){
                        console.log("Could not save value for relay runner: ", err);
                    }
                    else{
                        console.log("The runners updated: ",docs)
                    }

But I get the error:

Could not save value for relay runner:  
{ [MongoError: Can't canonicalize query: 
BadValue Unsupported projection option: 
$set: { Checked: true }] name: 'MongoError' }

This really is well documented. Will go away for sure, but just to explain for you:

relayModel.update(
    { "TeamName": "Team1" },
    { "$set": { "Checked": true } },
    { "multi": true },
    function(err,numAffected) {
        if (err) throw err;
        console.log( "updated n docs: %s", numAffected );
    }
);

So the .update() with a "multi" option affects more than one document, and without it it just affects the first document matched. The returned values in the callback are the standard err and the "number of documents affected".

Therefore basically speaking:

  1. You actually need and operator that "updates" in order to affect and update.

  2. You set "multi" for more than one document and you get only the number returned as well as using the $set operator to just affect the field that you want to change.