I\'m trying to use the sort feature when querying my mongoDB, but it is failing. The same query works in the MongoDB console but not here. Code is as follows:
You can try this:
db.Account.find().sort("UserName") db.Account.find().sort("UserName",pymongo.ASCENDING) db.Account.find().sort("UserName",pymongo.DESCENDING)