检查数据库是否存在

  1. import pymongo
  2.  
  3. myclient = pymongo.MongoClient('mongodb://localhost:27017/')
  4.  
  5. print(myclient.list_database_names())