Reputation: 1
I just started learning NoSQL in school and I keep getting
Traceback (most recent call last): File "/Users/balaji/Others/sssss.py", line 3, in <module> databases = client.database_names() TypeError: 'Database' object is not callable
this error when I try to run
import pymongo
client = pymongo.MongoClient("127.0.0.1", 27017)
databases = client.database_names()
print("The databases in the MongoDB server are:")
print(databases)
client.close()
Upvotes: 0
Views: 100
Reputation: 2911
MongoClient.database_names()
is deprecated and removed since pymongo
version 4.0. Use MongoClient.list_database_names()
instead.
Upvotes: 1