编程大白的博客

mongo:查找一个值find_one并排序sort

错误写法

mongo.db['records'].find_one({}).sort([('_id', -1)])

正确写法

mongo.db['records'].find_one({}, sort=[('_id', -1)])

参考

  • Python mongodb find_one() sort() AttributeError: ‘dict’ object has no attribute ‘sort’
« Previous

three.js从入门到精通系列教程043 - 创建行星按行星轨道围绕太阳公转

Next »

WEB前端IDE的使用以及CSS的应用

© 2024 编程大白的博客. Generated with Hugo and Mainroad theme.