'pushing to array using arrayFiilters
/* 1 */
{
"_id" : ObjectId("626398403905f04f59db38c7"),
"username" : "erkin",
"email" : "[email protected]",
"password" : "b",
"playlists" : [
{
"_id" : 58,
"name" : "asdsa",
"date" : "09-01-15",
"musics" : [
{
"name" : "INNA - Cola Song (feat. J Balvin)",
"duration" : "3.00"
},
{
"name" : "blabla",
"duration" : "3.00"
}
]
},
{
"_id" : 59,
"name" : "asdsa",
"date" : "09-01-15",
"musics" : [
{
"name" : "INNA - Cola Song (feat. J Balvin)",
"duration" : "3.00"
},
{
"name" : "blabla",
"duration" : "3.00"
}
]
}
]
}
I trying to push document playlist.music with id of 58
db.getCollection('playlist').updateOne({},
{$push:{"playlists.$[outer].musics":{name:'shiva',duration:'7.00'}}},
{$arrayFilters:[{"outer._id":58}]}
)
but it throws error:
"No array filter found for identifier 'outer' in path 'playlists.$[outer].musics'"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
