pymongo使用sort()语句报错:not enough values to unpack (expected 2, got 1)的解决方法

    技术2022-07-10  150

    最近在使用pymongo封装sort()语句时发现的错误: 找到解决方法: a = self.db[col].find(condition).sort([{’_id’: -1}]).limit(1) 但是又存在新的问题: 解决方法: 在本地pymongo库包的helpers.py文件中将for (key,value) in index_list:修改为for (key,value) in index_list[0].items(): 大功告成,可以正常返回排序查询的结果:

    Processed: 0.028, SQL: 12