MongoDB , . , , find, loop save.
update, ( ), {multi: true}, .
// Start with the "if" update
Documents.update(
{some_condition: true, "some field": "some condition"},
{$set: {"status": "value 1"}},
{multi: true},
function(err, numAffected) {
// Now do the "else" update, using $ne to select the rest of the docs
Documents.update(
{some_condition: true, "some field": {$ne: "some condition"}},
{$set: {"status": "value 2"}},
{multi: true},
function(err, numAffected) {
// All done.
}
)
}
)