解决方法:
db.collection.find().sort([("name", 1), ("age" , 1)])
原因:在python中只能使用列表进行排序,不能使用字典
博客介绍了在Python中使用MongoDB排序的解决方法,即使用db.collection.find().sort([(\name\ 1), (\age\ 1)])进行排序,原因是在Python里只能用列表排序,不能用字典。
解决方法:
db.collection.find().sort([("name", 1), ("age" , 1)])
原因:在python中只能使用列表进行排序,不能使用字典
463

被折叠的 条评论
为什么被折叠?