我有一个关于猫鼬模式的问题:
`var ProjectSchema = new mongoose.Schema({
name: String,
resources: [{
employee: {type: Schema.Types.ObjectId, ref: 'Employee'},
dailyRate: Number
}],`...
我尝试填充resources.employee
字段没有成功...已尝试过:
.populate('resources.employee')
.populate('resources.employee', model: 'Employee'})
任何建议?
提前致谢
答案 0 :(得分:0)
没关系,只是我的插件无效......
正确的语法是:
.populate({path:'resources.employee', model:'Employee'})