[pymongo] pymongo.errors.CursorNotFound Exception
生活随笔
收集整理的這篇文章主要介紹了
[pymongo] pymongo.errors.CursorNotFound Exception
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
由於find之後,loop執行時間過長導致timeout, cusor失效
解決方式有以下幾種:
1. 使用batch_size()
? ? cursor = collection.find({}).batch_size(30)
2. 將取出的cursor轉為list
? ? result = list(collection.find({}))
3. 取消timeout限制,要在cursor使用之後close
? ??cursor?= collection.find({}, no_cursor_timeout=True)
? ? cursor.close()?
# 最後一種方式,在使用時依然出現exception, 不清楚原因,有知道的朋友也請不吝賜教。
轉載于:https://www.cnblogs.com/sipher/p/11406898.html
總結
以上是生活随笔為你收集整理的[pymongo] pymongo.errors.CursorNotFound Exception的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 跳出小程序 video组件 卡顿、黑屏、
- 下一篇: python3 邮件方式发送测试报告