PyMongo聚合如何获取执行状态

时间:2019-05-22 09:05:18

标签: python mongodb aggregation-framework pymongo

我正在尝试获取特定mongo聚合查询的executionStats。我运行db.command,但是没有给出“执行状态”

这就是我想要做的。 how to get Python Mongo Aggregate explain using db.command?

pymongo aggregate don't allow explain option

1 个答案:

答案 0 :(得分:2)

这对我有用:

db.command('explain', {'aggregate': coll_name, 'pipeline': you_pipeline, 'cursor': {}}, verbosity='executionStats')