const personScheema = new Scheema({
info: {
firstName: String,
lastName: String
}
record: {
tests: [
[{
name: String,
report: {
comment: String,
attachments: [],
meta: {
addedBy: {
type: Scheema.Types.ObjectId,
ref: 'Person'
},
selected: Boolean,
dateAdded: Date
}
}
}]
]
}
})
上面是我想要在报告对象中填充“ add byBy”字段的示意图,但是当我尝试以下代码时,我一直得到空结果:
await Person.findById(req.params.id).populate({
path:'record.tests',
populate: {path:'report.meta.addedBy', Model: 'Person', select:'info'}
})
.exec()