I have do do something like this (please forgive me about the stupidity of the example... :-):
var dateRef = new Date(1990, 1, 1);
Person
.where('dateOfBirth').gte(dateRef)
.update({ $set: { isYoung: true } }, function (err, count) {
})
;
I.e.: I'd like to $set to true
field isYoung
for every Person document whose date of birth (dateOfBirth
) is later than a reference date.
My code is working for just one person, even if (currently) many documents do match the condition (all young people, here... :-).
Any clue?
P.S.: as a bonus, I'd like to set not-matching persons isYoung
field to false
, too, if possible...