Answers for "mongoos populate a ref"

0

mongoos populate a ref

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; // `[]`
Posted by: Guest on April-28-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language