【发布时间】:2023-03-16 18:13:01
【问题描述】:
我的架构如下:
const mock = new Schema({
category:...,
name:....,
doneBy: [{
type:mongoose.Schema.Types.ObjectId,
ref: 'User'
}]
})
查询:'doneBy' 属性是已完成任务的特定用户的数组。当我使用 console.log 时,它仅将 id 打印为“doneBy: [id1,id2,id3......]”。现在我想填充这些 id 以获取特定用户的信息。请分享方法。
【问题讨论】: