Closed cybercoder closed 4 years ago
Maybe you already figured something out but basically, you can't. However, there's a workaround. You can iterate the object you get from the aggregate and inside the iteration you can transform each item of the object to a mongoose Document like so:
const transformedDocument = new PostModel({...post})
Maybe you already figured something out but basically, you can't. However, there's a workaround. You can iterate the object you get from the aggregate and inside the iteration you can transform each item of the object to a mongoose Document like so:
const transformedDocument = new PostModel({...post})
Thanks for your reply, I needed to return null
when there was no translation for the requested item, So i did handle that manually without using this plugin. This plugin will return default locale contents when there is no translation.
Regards.
How i can use dynamic locale when aggregate? This is my aggregate expression:
I need to fetch only posts of one locale if that translation exists. The commented section not works.