You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indeed, this is not working out of the box in the library, because the feature you are looking for is a Mongoose feature whereas the library has been made to simply convert a query string to an object that can be useful for any mongo clients.
Having said that, mongoose is really popular. @jaysalvat already did a PR to handle "projection" (have a look at the mergeProjectionAndPopulation method). I am not a user of the "populate" feature from mongoose, but I think a PR which improve the mergeProjectionAndPopulation method to something more powerful like handleMongoosePopulation, which would extract not only projection, but also sort and filter from the top-level object and put them in the right place in the population object would be nice.
If you don't want to do a PR, this is something you can do on your side:
Right now the library will return something like this:
Hi Loris,
I'm using your lib for a long time and it's amazing: thanks!
I found some limits in sorting and filtering in populated content.
If I've understand well, it's impossible to sort by populated fields:
?populate=a,b,c&sort=a.f1,b.f2,c.f1
or to filter by populated fields:
?populate=a,b,c&a.f1=value&b.f2=value2
Is it right?
Do you have any suggestion about this need?
At the moment I tried to use "advanced filter" like
filter={"$or":[{"key1":"value1"},{"key2":"value2"}]}
but it's not so comfortable.
Thanks for any help ✌️
The text was updated successfully, but these errors were encountered: