Skip to content

populating virtual with same name as existing path #10765

Answered by vkarpov15
vineetdigit asked this question in Q&A
Discussion options

You must be logged in to vote

Unfortunately not with virtual populate. There's no way for a path to be both a real path and a virtual in a schema.

Why not just use conventional populate?

const SomeSchema = new Schema(
  {
    authoredBy: {
      type: Number,
      required: true,
      ref: 'Author'
    },

    .....
  });

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vineetdigit
Comment options

@vkarpov15
Comment options

Answer selected by Uzlopak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants