【发布时间】:2018-09-06 21:31:32
【问题描述】:
我有名为“asserts”和“users”的 mongo(mongoose) 集合。 在“断言”集合中有文档列表。 现在,在添加用户时,我需要选择多个“断言”。所以需要设置“ref”来断言集合。
下面是我的模态
asserts_list: {
type: [Schema.Types.ObjectId],
ref: "asserts" },
POST 操作工作正常(即)我可以在 Mongoose 的数组中添加多个对象 ID。但是在使用 AppComp.find({}) 和填充执行列表时,asserts_list 返回空数组([])。
帮助我使用 nodejs 在 find({}) 中检索对象 ID 数组。
【问题讨论】:
标签: javascript node.js mongodb