当我尝试在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等对查询进行解释。
答案 0 :(得分:0)
explain()仅在mongodb终端中有效,这就是为什么当我在python文件中使用mongodb查询运行explain()时出现错误