I have JSON of persons, each person has a list of kids:
{
"name": ":John",
"age": 35,
"kids": [
{
"name": "tom",
"age": 5
},
{
"name": "tina",
"age": 3
}
]
}
I want to perform findAndModify
where the person name is "John" and the kid name is "tina" and update her age to 7.
This is my query so far:
db.people.findAndModify({
query: { "name" : "John" {--HERE--}},
update: { $set: { "age" : 7 } }
})
What do I need to replace --HERE--
with to find the kid named "tina"?