按字母顺序对结果排序按字母顺序对结果排序import pymongo myclient = pymongo.MongoClient("mongodb://localhost:27017/")mydb = myclient["mydatabase"]mycol = mydb["customers"] mydoc = mycol.find().sort("name") for x in mydoc: print(x)