-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Virtual Populate foreignField is array in combination with UUIDs #15315
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
Comments
Ok, I found out, that the error is in this line: The ID is in Binary Format, one need to call
|
Edit: My quick fix is destroying other populations which are not virtual. So it's wrong. It seems like the rawDocs are having string keys. I could only fix it by changing line 81 of assignRawDocsToldStructure to
and line 4715 of model.js to
But this will not work with ObjectIds anymore. I know what the error is, but I have no idea how to fix it properly, because I don't know why it's sometimes a Buffer, sometimes a Binary... :( |
fix(populate): handle virtual populate on array of UUIDs
@vkarpov15 Thank you very much :) Will test it when it's released 🙏 |
@vkarpov15 Hey, I tested it now with 8.13.2 and have to say that it's still not working :( If I populate a virtualField while using UUIDs, the field is still null... |
The issue is, you fixed this code here:
But then you do this Edit: This line here is wrong: Line 4715 in 95a03cb
And probably this here too: Line 4692 in 95a03cb
If I change them to
it's a temporary fix for me, which works. If I copy your fix from assignRawDocsToldStructure it's NOT working, because the function toUUID() is missing and therefore the toUUID() is not called. |
Hello,
I have the exact same issue @Namchee had in this other issue. The query which Mongoose performs is correct, it would return the correct documents from the foreign schema. But it seems like it's not getting merged correctly afterwards...
Problem exists with Mongoose 8.12.0
P.S. I found out, it's only happening when using UUIDs instead of ObjectId.
Originally posted by @Namchee in #4585
The text was updated successfully, but these errors were encountered: