-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Mixing populated query results with model objects #570
Comments
I've encountered this issue as well, and it is mighty frustrating. Any word on a fix? |
relates to #601 |
If there was a manual_populate method, it might solve some of these issues ... another solution would be instead of having:
Automagically just keep the teacher_obj._id and leave the whole obj ... it would keep the full teacher_obj but when saving checks the schema and then only saves the teacher_obj._id at that point. |
+1 Needs to be consistent. Either store the field as an id always or an object. Preference would be an id, with a call to a populate like call that returns the object if present. |
without casting need to test string,number,buffer _ids yet part of #570
without casting need to test string,number,buffer _ids yet part of #570
when null or ObjectId was added relates to #570
add tests for docs with String, Buffer, and Number _ids relates to #570
also fixes legacy issue where single populated path was markedModified causing populated document to overwrite _id. relates to #570
without casting need to test string,number,buffer _ids yet part of #570
when null or ObjectId was added relates to #570
add tests for docs with String, Buffer, and Number _ids relates to #570
also fixes legacy issue where single populated path was markedModified causing populated document to overwrite _id. relates to #570
Setting a populated path (or manipulate a populated array) with works when the schema path does not have a `ref` declared and an adhoc model was used for population. relates to #570
fixed in 3.6 |
I have a Schema sorta like this (abbreviated here):
Here's my code to add a new comment. You can presume that std contains the result of a query like
And now I execute this code:
Assume there is already one Comment and I'm pushing a second one.
Here's what std.comments look likes at the render call
What you can see here is that the pre-existing Comment from the query result is populated, but the new one is not.
With the advent of the populate feature this kind of scenario is not going to be uncommon and it would be quite nice if the model objects the mongoose magic that turns comment.teacher back into an id was transparent.
The text was updated successfully, but these errors were encountered: