-
-
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
Populated paths toJSON options #3833
Comments
Right now we don't support that, either all subdocs use their schema-specified |
is a good idea, I actually figured out that populations are simple find calls so I decided to wrote the logic manually but it easily got very verbose |
Yeah this is a bit of an odd edge case. We don't have any way of defining options at a level between "define at function call" and "define on schema". Perhaps we could make |
@vkarpov15 in the end I had to stay with my custom logic because if I did something like this:
being Challenge.find async a different request could have called user.toJSON() in the meantime with the wrong minimize option. But it's really an edge case so don't worry if you don't want to implement it (I probably wouldn't since it's so easy to recreate the populate method manually) |
I have a model that gets populated from another model's document, the populated model has the option
minimize: false
set. I'd like to disable it when serializing the populated document:I need
chal.user
to be serialized withminimize: true
while havingchal
serialized with the default minimize option, in this caseminimize: false
The text was updated successfully, but these errors were encountered: