-
Notifications
You must be signed in to change notification settings - Fork 32
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
Subdocuments on populate don't get the lang feature applied #14
Comments
Please provide some example of your schema and expected results. |
For example: paymentMethods: [{
type: {
type: String,
enum: PaymentTypes
},
description: {
type: String,
intl: true
}
}] |
I can confirm this behavior as well. Any update here? |
Hey. |
What I found facing the same issue, is that Workaround is for sure explicitly call My schema:
And the acquire function:
Would be great to have this issue fixed somehow... Thanks! Update After some further research, I found the following issue in the mongoose repository: Automattic/mongoose#8092 (comment). I guess that's why populated documents don't apply parent's language. |
When I populate a document containing sub documents from different models. Even though those models have the intl fields applied. The populate result only applies translation on the Parent model only. Subdocuments show all fields instead of particular lang one.
I've tried all methods, document level setLanguage, schema level setDefaultLanguage etc.
Also I've also added hooks on sub documents of pre and post find and called the setLanguage there as well. But the populate call from parent response only gets me back the updated lang string of parent document.
The text was updated successfully, but these errors were encountered: