我需要为一个有200000多条数据记录的大型集合运行聚合查询。我想用pymongo
来运行它。我在文件里试过首选的方法。在
pipeline = [...]
db.command('aggregate', 'statCollection', pipeline=pipeline_aggregate)
但这返回了一个错误消息pymongo.errors.OperationFailure: The 'cursor' option is required, except for aggregate with the explain argument
。在
我用
allowDiskUse
选项解决了这个问题。这就是我的答案。在来自aggregation的mongo文档
您可以将
runCommand
更改为aggregate pipeline
,或者在命令中提供cursor
无
cursor
错误的runCommandwith
^{pr2}$cursor
返回游标with
explain:true
和no cursor
返回执行计划相关问题 更多 >
编程相关推荐