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
Support for nested virtuals, virtuals in subdocuments #245
Comments
Ofcourse this fix should also be applied to methods on subdocuments |
What if author is an array? can we do a virtual on each of this array? |
+1 support for arrays |
+100 support for arrays |
Figured it out:.
|
The solution above works, but you'll also need to set virtuals on for the nested schema:
|
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I haven't tried making a new schema for the author with its own virtuals. Maybe that would work, but according to other issue reports, sub-schemas work optimally in arrays a.t.m., not as plain subdocuments.
Looking at the source, this doesn't look to be impossible, just missing some clever split(".") logic while adding the virtual to the schema tree.
The get method works fine for the time being, but the other syntax would be preferrable. :)
The text was updated successfully, but these errors were encountered: