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
Marking field as populated manually? #2075
Comments
+1 Vote to implement this feature if it is not available for now, since it is really needed when writing unit-tests for models that use ref-s to other models. |
This is something that's on the list for mongoose 4.0. Right now, there's no good way to populate manually as far as I know. |
Thank you for your kind feedback! Looking forward to see this super awesome ODM fly up to the 4.0. |
Is this now possible? |
Yep in 4.0.1 you can do this for single populated subdocs (but not document arrays). For instance, OP's |
Thank you. Is there a documentation? |
Not yet, see #2884 to track. |
Thank you! |
Let's say I have
group
andmember
documents,member
was just created andgroup
was fetched earlier.After
member.group = group
themember.group
becomesObjectId
instead of document. The problem is that I need to use some virtuals, which, in turn, require full document, not just its id. Population works perfectly (awesome stuff, btw, thank you!), but the query is totally redundant as I already have thatgroup
.Is it possible to avoid this casting somehow? Or marking the
group
as it was populated?The text was updated successfully, but these errors were encountered: