I am trying to sort a collection called user_score using the key position and get the very first document of the result. In this case the collection user_score doesn't exist and I was hoping to get the result as None, but i was getting a cursor back.
1. result =
db.user_score.find({'score':'$lt':score}}).sort("position,pymongo.DESCENDING").limit(1)
Now i changed my query like below and did not get anything as expected.
2. result =
db.user_score.find_one({'score':{'$lt':score}}, sort=[("position", pymongo.DESCENDING)])
What's the problem with my first query?
Thanks