需要更新mongodb中的数组中的数组

我需要更新数组中的数组

{
  _id:1,data:[{
   dataId:1,nestedData :[{
      nestedDataid:12,price:150
    },{
      nestedDataid:122,price:10
    }]
  },{
   dataId:2,nestedData :[{
      nestedDataid:42,price:10
    },{
      nestedDataid:42,price:10
    }]
}]
}

我需要更新嵌套数组dataId =1和嵌套nestedDataid=12中的价格。我曾尝试过mongo $

{

        "data.dataId": 1,"data.nestedData.nestedDataid": 12
      },{
        step: 3,$set: { "data.0.nestedData.$.price": 200 }
      }

请让我知道如果我做错了任何事情,我们将不胜感激

kuuipoio 回答:需要更新mongodb中的数组中的数组

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3166402.html

大家都在问