-
Type: Bug
-
Resolution: Done
-
Priority: Trivial - P5
-
Affects Version/s: mongodb-3.2
-
Labels:None
Page: https://docs.mongodb.org/getting-started/python/query/
Zipcode is sorted in DESCENDING order but description notes that it sorts in ASCENDING order.
To sort by multiple keys, pass a list of keys and sort type pairs. For example, the following operation returns all documents in the restaurants collection, sorted first by the borough field in ascending order, and then, within each borough, by the "address.zipcode" field in ascending order:
import pymongo
cursor = db.restaurants.find().sort([
("borough", pymongo.ASCENDING),
("address.zipcode", pymongo.DESCENDING)
])