TypeError: ‘Collection‘ object is not callable. If you meant to call the ......

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

报错原因:

  pymongo4.0.1 发生了很大的改变,pymongo 4.0.1里不包含'Collection' object。

解决方法一:(我实验的时候,没能成功下载到低版本的pymongo)

(1)卸载pymongo 4.0.1

C:\Users\nx>pip uninstall pymongo

(2)安装pymongo-3.5.1

C:\Users\nx>pip install pymongo==3.5.1

解决方法二:

把不能调用的函数改换成pymongo4.0.1中功能类似的函数或者自己实现那个函数功能。

猜你喜欢

转载自blog.csdn.net/weixin_48419914/article/details/124315182