I want to delete an object in a deep nested array in mongoDB. I tried the following query, but it does not work. The query should delete all the tags that contain "C#" as text, in each experience.
Thanks!
//// QUERY ////
db.getCollection('resumes').update(
{},
{ $unset :{ 'experiences.$.tags': { text:"C#"}}}
)
//// JSON ////
"_id" : "1",
"name" : "General Resume",
"experiences" : [
{
"id" : 1,
"companyName" : "Mirco",
"summary" : "Mirco is Belgium’s largest distributor of medication and other pharmaceutical products. They have an internal software team that develops customized ERP software in .NET for Mirco and its subsidiary PDC.",
"task" : "Development of new features of the Mirco ERP and PDC ERP backends (domain and service layers) and implementation of message handlers to interface with external software components. Adding new features to the PDC ERP WinForms frontend.",
"tags" : [
{
"text" : "Visual Studio .NET 2013"
},
{
"text" : "C#"
},
{
"text" : "Subversion"
},
]
},
{
... multiple experiences which contain a C# tag
}
],