首页 > 解决方案 > MongoDB多维数组

问题描述

我对整个多维更新 Longs 和 Lats 有问题,我不确定如何允许使用用户提交的内容更新当前数据。注意:我试过环顾四周,这些例子仍然不起作用

  Route.updateOne({ _id: Ids,  'Routes.Waypoints.Latitude': Lat, 'Routes.Waypoints:Longitude': Long }, { $set: {Routes:{Waypoints:{Latitude: NewLat, Longitude: NewLong }}}}, {  new: true },
       function (err, UpdatePoints) {
        if (err) console.error(err);
        if (UpdatePoints) {
        console.log(UpdatePoints)
        }
      })
     
    })

标签: javascriptnode.jsmongodbmongoose

解决方案


推荐阅读