{
"partners" : [
{
"partnerId" : 5,
"topicIds" : [
"59de26f2e4b0f263704769e5"
]
},
{
"partnerId" : 45,
"topicIds" : [
"alpha",
"beta"
]
},
{
"partnerId" : 12345,
"topicIds" : [
"alpha"
]
}
]
}
I want to pull certain topicIds from specified partners. So for example I want to pull alpha topic from partnerId = 45 (the entry should remain with topicIds = ["beta"]).
I tried:
db.mypartnercoll.update({}, {$pull:{"partners":{"partnerId":45, "topicIds":{"$in":["alpha"]}}}})
however this removes the entire partnerId = 45 entry. I will have a single partnerId value and multiple topicIds to pull.