pymongo.errors.OperationFailure:Overflow sort stage buffered data usage exceeds in internal limit

来源:互联网 发布:想加盟淘宝网店 编辑:程序博客网 时间:2024/05/16 16:10

    用pymongo接口调用find().sort()方法时,出现错误。报错内容为:

>>> pymongo.errors.OperationFailure: database error: Plan executor error during find: Overflow sort stage buffered data usage of 33574037 bytes exceeds internal limit of 33554432 bytes

    这是因为在做sort()时,超过了32MB的in-memory sort。解决方法是可以在mongodb的相应数据库修改该内存上限。

    如,我的原代码是:

>>> client = MongoClient('localhost',27018)>>> db = client['NetEase']>>> col = db['comment_content']>>> for item in col.find().sort('page_index',pymongo.ASCENDING):    ...     print item['page_index']

    那么就修改为

>>> mongo --port=27018>>> use NetEase>>>db.adminCommand({setParameter: 1, internalQueryExecMaxBlockingSortBytes: <limit in bytes>})

就好了.

0 0
原创粉丝点击