【发布时间】:2021-12-02 11:22:59
【问题描述】:
模型A看起来像
{ a : {
step1: [{
type: { type: String },
category: { type: String },
}],
step2: [{
type: { type: String },
category: { type: String },
}]
} }
我想创建的模型 B 应该包含一个引用模型 A.step1 或 A.step2 的道具,试图通过以下方式实现这一目标
{ progress : [
{
step: {
type: Schema.Types.ObjectId,
ref: "A.a.{What should be here}",
required: true,
},
details: { type: Schema.Types.Mixed },
}
]
}
【问题讨论】:
标签: mongodb mongoose mongodb-query mongoose-schema mongoose-populate