I have below json data.
{
"_id" : ObjectId("57d66e95e5a5532a6ac91df6"),
"array1" : [
{
"_id" : ObjectId("57d6857005bf3530bd25e26d"),
"array2" : [
{
"_id" : ObjectId("57d6857005bf3530bd25e26e"),
"data1" : "VoiceCall",
"data2" : 12345
},
{
"data1" : 12848,
"data2" : "VideoCall",
"_id" : ObjectId("57d6858205bf3530bd25e26f")
}
]
}
]
}
now I want to update like this:
db.getCollection('test').update({
_id: ObjectId('57d66e95e5a5532a6ac91df6'),
"array1.array2._id":ObjectId('57d6858205bf3530bd25e26f')
},{$set:{"array1.array2.$.data1":121212}})
but this is not allowed in mongodb.
Please help to update it.