I've this document:
{
"_id" : ObjectId("540d881d475d68010693e340"),
"notes" : [
{
"owner" : null,
"creation" : 1411641315424,
"text" : "test rec",
"action" : "0",
"recipients" : [
{
"username" : "root",
"read" : false
},
{
"username" : "zivolof",
"read" : false
}
]
},
{
"owner" : null,
"creation" : 1411641315424,
"text" : "test rec",
"action" : "0",
"recipients" : [
{
"username" : "root",
"read" : false
},
{
"username" : "zivolof",
"read" : false
}
]
}
]
}
I find it with this query:
{
"_id": id,
"notes.recipients": {
$elemMatch: {
username: username,
read: false
}
}
}
I then need to update the read flag of the entire document to true. How can I do?