本文介绍了pymongo聚合不允许解释选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我成功运行:
result = my_col.aggregate(my_pipeline, allowDiskUse=True)现在,当我尝试:
result = my_col.aggregate(my_pipeline, allowDiskUse=True, explain=True)它没有说:
pymongo.errors.ConfigurationError: The explain option is not supported. Use Databasemand instead.因此,我尝试添加所需的选项:
Thus I try so as to add the needed option:
result = mydbmand('aggregate', 'mycol', my_pipeline, {'explain':True})但没有说:
pymongo.errors.OperationFailure: 'pipeline' option must be specified as an array怎么了?
谢谢您的建议.
基督徒
推荐答案使用"pipeline"关键字参数将管道传递给"command":
Pass your pipeline using the "pipeline" keyword argument to "command":
dbmand('aggregate', 'mycol', pipeline=my_pipeline, explain=True)例如:
dbmand('aggregate', 'mycol', pipeline=[{'$project': {'name': '$field'}}], explain=True)更多推荐
pymongo聚合不允许解释选项
发布评论