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
}
}
}]
]
}
})
Выше приведена схема, которую я хочу заполнить полем "AddedBy" в объекте отчета, но я продолжаю получать нулевой результат, когда я пробую приведенный ниже код:
await Person.findById(req.params.id).populate({
path:'record.tests',
populate: {path:'report.meta.addedBy', Model: 'Person', select:'info'}
})
.exec()