【问题标题】:TypeError: 'Collection' object is not callable. If you meant to call the 'explain' method on a 'Collection'TypeError:“集合”对象不可调用。如果您打算在“集合”上调用“解释”方法
【发布时间】:2020-01-21 21:30:04
【问题描述】:

当我试图在我的 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 等解释我的查询。

【问题讨论】:

    标签: python-3.x mongodb


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2022-01-14
      • 2019-04-10
      • 2016-06-09
      • 1970-01-01
      • 1970-01-01
      • 2015-05-12
      • 2014-02-09
      • 2016-05-16
      • 1970-01-01
      相关资源
      最近更新 更多