How to get a list of all databases in a mongo instance using pymongo
1 answer
Use database_names
dbs = MongoClient().database_names()
As Andrew Aller points out: As of pymongo 3.6, database_names () has been deprecated in favor of list_database_names .
dbs = MongoClient().list_database_names()
+7
source to share