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

相关文章:

  • 2021-08-10
  • 2022-12-23
  • 2021-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-29
  • 2021-08-17
  • 2021-05-11
  • 2022-12-23
  • 2021-11-11
相关资源
相似解决方案