How do I sort the query objects in MongoEngine, like I would in a regular mongodb query?
http://www.mongodb.org/display/DOCS/Sorting+and+Natural+Order
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Mongoengine is inspired by Django’s ORM, and like Django, it uses
order_byto sort the result set.order_bytakes a variable number of string arguments, which are the field names (as defined in your documents) optionally preceded by a “-” (to indicate a descending sort, i.e. highest first).For example: