在嵌套文档中添加新数组

时间:2019-08-31 20:23:33

标签: node.js mongodb mongoose mongodb-query

我想在嵌套文档中添加一个新数组,这是c集合中数组的第二级。我想在listSubnames e中添加一个新数组。您能帮我写一下以下要求的查询吗?

          {  
            "Value":"Example2",
            "Value":"000000000000001",
            "sectionroles":["test11", "test12", "test13"],

         }

下面是我的文档

       {  
   "id":"Test",
   "name":"Test",
    "sections":[  
   {  
      "sectionname":"Example1",
      "sectionroles":["test1", "test2", "test3"],
      "subcategory":[ 
   "subname":"Coke"
     "listSubnames":[

         {  
            "Value":"demo",
            "ValueId":"123333333333",
           "sectionroles":["test1", "test2", "test3"],
         },
         {  
            "Value":"Example2",
            "Value":"6577544333333",
            "sectionroles":["test1", "test2", "test3"],

         }
      ]
      ]
       }

0 个答案:

没有答案