📜  参考猫鼬示例 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:08.151000             🧑  作者: Mango

代码示例2
const storySchema = Schema({
  authors: [{ type: Schema.Types.ObjectId, ref: 'Person' }],
  title: String
});

// Later

const story = await Story.findOne({ title: 'Casino Royale' }).populate('authors');
story.authors; // `[]`