{
"_id" : "TestData123",
"data" : [
{
"ch" : "test1",
"prod" : [
{
"sid" : "1",
"value" : " TV"
},
{
"sid" : "2",
"value" : "amazon",
},
{
"sid" : "3",
"value" : "ebay",
},
{
"sid" : "4",
"value" : "otherthing",
}
]
},
{
"ch" : "test2",
"prod" : [
{
"sid" : "6",
"value" : "TV",
},
{
"sid" : "7",
"value" : "amazon",
},
{
"sid" : "8",
"value" : "ebay",
},
{
"sid" : "9",
"value" : "otherthing",
}
]
}
]
}
I have a mongoDB collection in the above format. I need to remove/empty the array 'prod' in ch:test1 and ch:test2. Also please suggest the mongo query for adding the elements to these as well.