Scille/umongo

sort direction does not work

Closed this issue · 2 comments

jbkoh commented

Hi,

I realized that the direction in sort function does not work with - sign. I'm also not sure if it's actually supported, because it's not documented. Let me know if I missed it.

I want MyDocument.find({}).sort("-my_version").limit(1) to indicate that I want to sort the results by descending order of my_version field like this. The query returns results without an error but they are still in the ascending order.

I'm also curious if it's just sorting the results set after pulling all the data from the db, or actually receiving sorted and limited results (in this case only one document) from the database.

Thanks!

jbkoh commented

And, does umongo have an API to send a raw query to the database?

jbkoh commented

Found that the sort is an alias to Motor APIs. I'm using -1 explicitly, and it's working. thanks