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 bug - populate not working - idField mapped to undefined (issue #325, maybe #296) #327

Merged

Conversation

someone635
Copy link
Contributor

This is a follow-up bug from #254 . It was supposed to be fixed then, but I got the same issue today. To reproduce, simply use one of the tests in the commit without the fix. The _get method with _mapping: true fails with custom idFields and returns undefined for the mapping key. Since that is what is used during population, population is also broken, which could fix issues #325 and #296.

The problem was the line origDoc = doc, which did not truly copy the document, simply assigned it by reference. Our reference to the original document was thus lost during transformDocument method, as doc variable is mutated there.

Copy link
Member

@icebob icebob left a comment

Choose a reason for hiding this comment

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

Thanks. I've added some improving, and found another issue with encoded ID logic, so also fixed it.

@icebob icebob merged commit f34e6c6 into moleculerjs:master Nov 6, 2022
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.

2 participants