I am trying to push an object to the deeply nested checklist array below :
{
// User
_id : "id",
days : [
{
_id : "id"
day : "6",
tasks: [
{
_id : "id",
name : "todo"
types : {
checklist : [] // i want to push objects here
notes : []
}
},
....
]
},
....
]
}
Here is what i have tried but failed... my guess is that the $ operator shouldn't be at that position:
User.update({_id : user._id , "days.tasks.name": 'todo' } ,{ $push : { 'days.tasks.$.types.checklist' : { data : 'hello World' } }})