草庐IT

VehicleGroups

全部标签

node.js - Mongoose :如何插入嵌套数组?

这个问题在这里已经有了答案:UpdatingaNestedArraywithMongoDB(2个答案)关闭3年前。我是NoSQL世界的新手。这是我的Mongoose架构的屏幕截图。我需要在vehicles数组中插入、更新和删除文档。到目前为止我尝试了什么:添加:(工作)Companies.findOne({'mobile':givenMobileNumber,'VehicleGroups.vehicle_group_id':vehicleGroupId},(err,res)=>{if(err||res==null){callback(err,res);}else{varlen=res.