更新时间:2023-02-21 12:17:24
userSchema
中的ref
似乎不正确,它应该引用book
模式而不是user
模式本身.
It seems the incorrect ref
in the userSchema
, it should reference to book
schema rather than user
schema itself.
var book = mongoose.model('Book', bookSchema);
...
books: [{type: Schema.Types.ObjectId, ref: 'book'}]