[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, 不清楚原因,有知道的朋友也請不吝賜教。
[pymongo] pymongo.errors.CursorNotFound Exception的更多相关文章
- mongodb pymongo.errors.CursorNotFound: Cursor not found, cursor id: 82792803897
默认 mongo server维护连接的时间窗口是十分钟 默认 单次从 server获取数据是101条或者 大于1M小于16M的数据 所以默认情况下,如果10分钟内未能处理完数据,则抛出该异常. 解决 ...
- 【pymongo.errors】Cursor not found
pymongo.errors.CursorNotFound: Cursor not found 故事背景:先从数据库中取得所有数据 db['test'].find(),然后对结果进行for循环,但是当 ...
- [mongoDB]PyMongo Cursor Not Found Error
Python跑一个aggregate脚本,报错:pymongo.errors.CursorNotFound: Cursor not found, cursor id: 35411720832 搜了下原 ...
- 高可用性和PyMongo
High Availability and PyMongo高可用性和PyMongo************************************ PyMongo makes it e ...
- pymongo使用总结
0. 何为pymongo pymongo是操作MongoDB的python模块 1.安装pymongo # easy_install pymongo 2.连接mongodb >>> ...
- pymongo连接MongoDB
导语 pymongo 是目前用的相对普遍一个python用来连接MongoDB的库,是工作中各种基本需求都能满足具体api可以参考 pymongo APIpymongo github 安装 Mongo ...
- 7.mongo python 库 pymongo的安装
1.Python 中如果想要和 MongoDB 进行交互就需要借助于 PyMongo 库,在CMD中使用命令即可[注意此处是pip3,pip无法安装]: pip3 install pymongo 2. ...
- JAVA fundamentals of exception handling mechanism
Agenda Three Categories Of Exceptions Exceptions Hierarchy try-catch-finally block The try-with-reso ...
- [AngularJS] Catching errors with $exceptionHandler
The AngularJS $exceptionHandler service allows you to catch and handle unanticipated JavaScript erro ...
随机推荐
- live-pusher属性值的改变
例如:组件推流过程中,切换前后摄像头时,要改变mirror的值并使其生效: LivePusherContext = wx.createLivePusherContext() 1. LivePusher ...
- SpringBoot配置ThreadPoolTaskExecutor
package com.example.demo; import org.springframework.context.annotation.Bean; import org.springframe ...
- 解决关于VC++ 6.0打开文件时,程序停止的问题
不少boys和girls安装VC++ 6.0英文版后,开始学习C++语言,但是使用软件的过程中,点击“打开”时,就会出现程序进程错误,崩溃的事儿,很是郁闷.最后直接一个对话框如下: 并且vc6.0直接 ...
- Error handling in Swift does not involve stack unwinding. What does it mean?
Stack unwinding is just the process of navigating up the stack looking for the handler. Wikipedia su ...
- python语言(二)列表、字典、集合、文件读写、关系测试
1.列表 list 代码 s = '王宇建,苏红,邹存才...' # 列表 数字 list l = ['王宇建','苏红','邹存才'] # 一维数组 二维数组 三维数组 # 0 1 2 # 索引 ...
- [Git] Remove Files from Staging Before Committing
If you've added files to the staging area (the Index) accidentally - you can remove them using git r ...
- Hibernate中对象的三种状态即save(),update(),saveOrUpdate()的使用【转】
当new一个user的时候,是处于瞬时状态 当调用session.save(user)的时候,user对象会放到session里,此时处于持久状态 当提交事务的时候,user对象才会存到DB中 当调用 ...
- learning shell monitor prog function
[Purpose] Shell script monitor prog function [Eevironment] Ubuntu 16.04 bash env [ ...
- Openwrt build env setup(9)
reference : https://openwrt.org/docs/guide-developer/quickstart-build-images Install dependence pack ...
- graphql-compose graphql schema 生成工具集
graphql-compose 是一个强大的graphql schema 生成工具集 包含以下特性 快速便捷的复杂类型生成 类型仓库,类型可以存储在schemacomposer 存储中 包含flowt ...