TypeError: ‘Collection‘ object is not callable.

1.用pymongo库连接mongoDB时报错

2.解决方法

(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

3.问题解决。 

 总结:pymongo 4.0.1里不包含'Collection' object。

 

TypeError: 'dict' object is not callable错误是由于函数名与变量名冲突导致的。具体来说,当我们定义了一个名为dict的变量后,调用dict()函数时就会发生冲突,并报出这个错误。要解决这个问题,我们可以删除之前定义的变量。可以使用del语句来删除变量,例如del dict。这样就能解决TypeError: 'dict' object is not callable错误了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [TypeError: ‘dict‘ object is not callable](https://blog.csdn.net/zymhhh/article/details/127705295)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Django错误:TypeError at / 'bool' object is not callable解决](https://download.csdn.net/download/weixin_38682790/12860392)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [TypeError:'dict' object is not callable](https://blog.csdn.net/qq_43199836/article/details/82937844)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值