首页 > 其他 > 详细

[pymongo] pymongo.errors.CursorNotFound Exception

时间:2019-08-25 09:34:26      阅读:98      评论:0      收藏:0      [点我收藏+]

由於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() 

[pymongo] pymongo.errors.CursorNotFound Exception

原文:https://www.cnblogs.com/sipher/p/11406898.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!