深度数组中的MongoDB删除对象无法正常工作

时间:2015-12-18 14:37:45

标签: json mongodb

我想删除mongoDB中深层嵌套数组中的对象。我尝试了以下查询,但它不起作用。查询应删除包含" C#"的所有标记。作为文本,在每次经历中。

谢谢!

//// 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
        }
    ],

0 个答案:

没有答案