如何在MongoDB中更新嵌套数组
假设我们收集了以下数据
{ "_id" : ObjectId("59d1f9f366e0852538645961"), "agentId" : ObjectId("59d1f9f366e0852538645960"), "level" : 1, "totalCommission" : 0, "createDate" : "Mon Oct 02 2017 14:03:55 GMT+0530 (India Standard Time)", "work" : [ { "commission" : [], "project" : {}, "enquiry" : { "createDate" : ISODate("2017-10-02T13:17:31.907Z"), "quarter" : { "_id" : ObjectId("59d21e2f5fa00a1734d9f847"), "type" : "4", "startMonth" : "October", "endMonth" : "December", "month" : "January", "DisbursementStartDate" : 15, "DisbursementEndDate" : 20, "__v" : 0 }, "enquiryId" : ObjectId("59d23c6bd5077719009c1d07") }, "enquiryId" : ObjectId("59d23c6bd5077719009c1d07"), "createDate" : ISODate("2017-10-02T13:17:31.907Z"), "projectId" : ObjectId("59d245a27300631918cd7641") } ], "__v" : 0
}
现在,我想更新或推动arrays“工作”下存在的“委托”数组中的对象。
- Mongoose.js:是否可以更改ObjectId的名称?
- 无法获取我的数据库(MongoDB)的数据输出在我的网站上
- Loopback.js – 将基础“用户”模型扩展为“用户”,而不需要MongoDB创build“用户”和“用户”集合
- 如何从mongoose获取mongodb版本
- 在Node.js中,引用同一个文件中的另一个函数会导致“ReferenceError:-function- is not defined”错误
- 如何从mongoosearrays中获取数据?
- mongoose save()不是函数
- 什么是Mongoose(Nodejs)复数规则?
- nodejs mongodb驱动程序在闲置时断开连接