📜  mongoos 填充参考 - Javascript 代码示例

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

代码示例1
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; // `[]`