貓鼬種群與對象嵌套使用貓鼬種群直接包含對象?什么時候應(yīng)該分別使用?貓鼬種群的例子:var personSchema = Schema({
_id : Number,
name : String,
stories : [{ type: Schema.Types.ObjectId, ref: 'Story' }]});var storySchema = Schema({
_creator : { type: Number, ref: 'Person' },
title : String,});貓鼬對象嵌套示例:var personSchema = Schema({
_id : Number,
name : String,
stories : [storySchema]});var storySchema = Schema({
_creator : personSchema,
title : String,});
- 1 回答
- 0 關(guān)注
- 622 瀏覽
添加回答
舉報
0/150
提交
取消