0
填充我有一個數據,如如下如何通過對象數組中貓鼬
"student" : [
ObjectId("58500ea5ef914125073b040f"),
ObjectId("58500ea5ef914125073b042e")
],
我的模型,
student: [{type: Schema.ObjectId,ref: 'Student'}],
我想這些數組中填充學生,
Classroom.findById(id).populate('student.student'){}
它不工作,任何人都可以請建議help.Thanks。
你加裁判模型的模式'學生:[{類型:Schema.Types.ObjectId,REF: '學生'}]' – styopdev
是的,我做到了..... – MMR
你可以顯示你的模式的代碼,並確保你有適當的數據來填充數據庫。 – styopdev