title: Checking if a MongoDB server is up without knowing any databases
body: <p>I'm creating a MongoDB connector for an application, and was wondering if it's possible to check if a MongoDB server is up without knowing any databases.</p>
  
  <p>Every example I have seen so far requires deprecated methods or a database on the MongoDB server to be known.</p>
  
  <p>An example of what I'm trying to do can be seen below;</p>
  
  <p><a href="https://stackoverflow.com/questions/28835833/how-to-check-connection-to-mongodb">How to check connection to mongodb</a></p>
  
  <p>One way I thought about doing this was to use;</p>
  
  <pre><code>ListDatabaseNames()
  </code></pre>
  
  <p>catching any exceptions that relate to a connection failing. However, this seems like a bit of a 'dirty' solution, as I would also have to catch all exceptions relating to invalid permssions to run the command.</p>
  
  <p>Perhaps, what I'm trying to do, doesn't make sense. If that's the case, please do say!</p>