【发布时间】:2015-05-22 10:28:56
【问题描述】:
在我的 Flask 应用程序中,我已经导入了 pymongo:from pymongo import MongoClient
然后我调用我的 connect_db 方法:
db = get_db(connect_db())
方法编码如下:
def connect_db():
client = MongoClient("localhost", 27017)
return client
def get_db(client):
return client(DATABASE)
但我收到错误 TypeError: 'MongoClient' object is not callable
我在https://api.mongodb.org/python/current/tutorial.html找到它
什么原因?
【问题讨论】: