Python MongoDB
MongoDB Sort
Sorting documents
MongoDB Sort
Use the sort() method to sort the result in ascending or descending order.
Sort Results
mydoc = mycol.find().sort("name")
for x in mydoc:
print(x)
Sorting documents
Use the sort() method to sort the result in ascending or descending order.
mydoc = mycol.find().sort("name")
for x in mydoc:
print(x)