title: How to check if a database exists on MongoDB without using mongClient.getDatabaseNames()
body: <p>we configured our mongobd to forbid the “listdatabase” (i.e,  mongClient.getDatabaseNames()) feature for privacy reasons</p>
  
  <p>I would like to check whether a database exists in MongoDB without using mongClient.getDatabaseNames().</p>
  
  <p>If I use, mongoClient.getDB("mydb"), mongodb creates a new db instance which can't help to check whether dbname exist.</p>
  
  <p>Any suggestions please?</p>
  
  <p>We have a common 'ui connection wizard' to connect to different mongodb servers which have different authentications. This wizard has to verify "dabase_name" field, whether user entered correct database name. In this case, "listDatabase"( i.e client.getDataBaseNames()) can't be used as authentication fails or "use db"(i.e, client.getDB()) can't be used as it creates an new db instance.</p>