Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法指定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 this issue May 14, 2024 · 2 comments

Comments

@wang-xiaowu
Copy link

wang-xiaowu commented May 14, 2024

重现步骤

  • 会话管理(进程状态)/在线查询/Sql上线 等等
  • 选择mongo实例

预期外的结果

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_
@wang-xiaowu wang-xiaowu changed the title 查询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. 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. May 14, 2024
@wang-xiaowu wang-xiaowu changed the title 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. 无法指定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. May 14, 2024
@solomon-cc
Copy link
Contributor

solomon-cc commented May 14, 2024

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

@sunbluers
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants