-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
execPopulate on virtuals is not working #5240
Milestone
Comments
Thanks for reporting, will fix for next minor release 👍 |
It seems this brought a regression. I have virtual populates not being populated correctly now. I'll investigate to see what's happening exactly |
Yep, populate with execPopulate was broken on nested documents, now it is broken on the first level. 4.10.0 is good, 4.10.1 isn't SomeModelSchema.virtual('bar', {
ref: 'OtherModel',
localField: 'otherModelId',
foreignField: 'id',
});
// This works, result.bar[0] is an OtherModel document
let result = await SomeModel.findOne({}).populate('bar');
// This does not work, result.bar is null
result = await SomeModel.findOne({});
result = await result.populate('bar').execPopulate(); Got any idea @vkarpov15 ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to use virtual populates as explained in this post: http://thecodebarbarian.com/mongoose-virtual-populate
When using
populate
with find, there is no problem. However, populating afterwards on a document does not seem to be workingex:
The text was updated successfully, but these errors were encountered: