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

fix(populate): handle specifying recursive populate as a string with discriminators #12266

Merged
merged 1 commit into from Aug 23, 2022

Conversation

vkarpov15
Copy link
Collaborator

Summary

A bug that I ran into earlier today. If you populate() on a discriminator model and set the populate option to a string as follows:

return Log.find({}).
              populate({
                path: 'activity',
                populate: 'postedBy'
              }).
              sort({ seq: -1 });

You'll get the following error:

TypeError: Cannot create property 'strictPopulate' on string 'postedBy'

This fixes that case

Examples

Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks 👍

@vkarpov15 vkarpov15 added this to the 6.5.3 milestone Aug 23, 2022
@vkarpov15 vkarpov15 merged commit 8e49fa6 into master Aug 23, 2022
@vkarpov15 vkarpov15 deleted the vkarpov15/fix-discriminator-subpopulate-string branch August 23, 2022 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants