hhyo / Archery

SQL 审核查询平台
https://archerydms.com
Apache License 2.0
5.75k stars 1.63k forks source link

无法指定Mongo实例操作:`'Collection' object is not callable. If you meant to call the 'authenticate' method on a 'Database' object it is failing because no such method exists.` #2641

Open wang-xiaowu opened 1 month ago

wang-xiaowu commented 1 month ago

重现步骤

预期外的结果

image

日志文本

2024-05-14 10:19:35,920 - default - WARNING - mongodb获取连接信息错误,错误信息Traceback (most recent call last):
  File "/opt/archery/sql/engines/mongo.py", line 1206, in current_op
    conn = self.get_connection()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/sql/engines/mongo.py", line 806, in get_connection
    self.conn[self.db_name].authenticate(self.user, self.password, auth_db)
  File "/opt/venv4archery/lib/python3.11/site-packages/pymongo/collection.py", line 3501, in __call__
    raise TypeError(
TypeError: 'Collection' object is not callable. If you meant to call the 'authenticate' method on a 'Database' object it is failing because no such method exists


### 版本

1.11.1

### 部署方式

Docker

### 是否还有其他可以辅助定位问题的信息?比如数据库版本等

_No response_
solomon-cc commented 1 month ago

应该是pymongo从3.x升级4.x导致的,4.x认证方式变了

sunbluers commented 1 month ago

我使用的python3.9,也遇到相同的问题