【发布时间】:2016-10-26 12:13:42
【问题描述】:
我正在尝试抓取一个巨大的 (5gb) mongo 数据库,因此我限制了批处理大小以便于管理。但是,我仍然收到超时错误:/
诚然,我的 mongo 知识不是最好的,所以如果我在做一些完全愚蠢的事情,请告诉我!我已经搜索了文档和其他问题,但没有一个答案有帮助。
这是我想要做的:
from pymongo import MongoClient
collection = MongoClient(host="mongodb://xxx@xxx")
cursor = collection.all_companies.companies
batch = cursor.find().batch_size(1).limit(1) # I tried w/ other numbers too
for item in batch:
print item
这就是我得到的:
pymongo.errors.ServerSelectionTimeoutError: xxx:xxx: 超时
【问题讨论】:
标签: python mongodb collections timeout pymongo