多个值的更新

{
        "_id" : ObjectId("51596b7e469b9c3816000001"),
        "company" : {
                "_id" : "ade2fd0ec9b8b5e9152e0155",
                "title" : "LO3426546457"
        },
}
{
        "_id" : ObjectId("51596cef469b9c3816000008"),
        "company" : {
                "_id" : "ade2fd0ec9b8b5e9152e0155",
                "title" : "LO3426546457"
        },
}
{
        "_id" : ObjectId("51596cc3469b9c3816000007"),
        "company" : {
                "_id" : "ade2fd0ec9b8b5e9152e0155",
                "title" : "LO3426546457"
        }        
}

Collections.UsersCollection.update({ 'company._id': id }, { $set: { 'company.title': title } }, {upsert: false, multi: true})

 

你可能感兴趣的:(更新)