Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document.populated() & Document.$getPopulatedDocs() not work when populating Virtuals in Query #10148

Closed
L-Trump opened this issue Apr 16, 2021 · 0 comments
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Milestone

Comments

@L-Trump
Copy link

L-Trump commented Apr 16, 2021

    let doc = await this.mainModel.findById(frameId).populate({
      path: 'position'
    });
    console.log(doc.populated('position'), doc.$getPopulatedDocs()); // undefined, TypeError

However, populate by Documents works

    let doc = await this.mainModel.findById(frameId);
    await doc.populate({
      path: 'position'
    }).execPopulate();
    console.log(doc.populated('position'), doc.$getPopulatedDocs()); // truthy value, [doc]
@IslandRhythms IslandRhythms added needs repro script Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue needs clarification This issue doesn't have enough information to be actionable. Close after 14 days of inactivity labels Apr 16, 2021
@vkarpov15 vkarpov15 added this to the 5.12.7 milestone Apr 23, 2021
@vkarpov15 vkarpov15 added confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. and removed needs clarification This issue doesn't have enough information to be actionable. Close after 14 days of inactivity needs repro script Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue labels Apr 23, 2021
vkarpov15 added a commit that referenced this issue Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Projects
None yet
Development

No branches or pull requests

3 participants