I want to make an update into an array nested inside of an object inside of another array. This is the find method that worked for me to retrieve the object I am interested in:
db.getCollection('messagings').find({
id: '563f8ed864e68e4c200bed45',
missions : {
'$elemMatch' : {
id: '563f8ed864e68e4c200bed46',
messages : {
'$elemMatch' : {
timestamp : ISODate("2015-11-09T15:32:30.615Z")
}
}
}
}
})
And I would like to update an element inside of an element of messages and I tried like this but obviously it didn't work...
{'mission.$.messages.$.message' : 'How are you ?'}
How can I make the update using mongoose in nodejs.