I have updated my Meteor.users() collection to include a 'profile' subdoc and inside profile I have an array of objects called 'notifications'. The object structure for notifications looks like this:
'profile.notifications': {
prompt: prompt,
message: message,
hasBeenRead: false,
timestamp: Messages.find({}, {sort: {"ts": 1}, limit: 0}).fetch().pop().ts,
}
Is there a way, using one of Mongo's methods, to change hasBeenRead to true for all of the objects within the array? I can change just one element using array indexes (the code below), but I can't use this approach to change all of them at once.
Meteor.users.update({
_id: Meteor.userId()
}, {
'profile.notifications.0.hasBeenRead': true //only changes first elem
}
})