TypeError:“集合”对象不可调用。如果您要在“集合”上调用“解释”方法

时间:2019-09-20 20:33:56

标签: python-3.x mongodb

当我尝试在python文件中调用explain()时出现错误:


'Collection' object is not callable. If you meant to call the 'explain' method on a 'Collection' object it is failing because no such method exists.

db.collection.explain().aggregate(pipeline=data_pipe)

我想用ExecutionTime,saveState等对查询进行解释。

1 个答案:

答案 0 :(得分:0)

explain()仅在mongodb终端中有效,这就是为什么当我在python文件中使用mongodb查询运行explain()时出现错误