title: test mongo db connection php script
body: <p>I am quite new to Mongo, been playing around with it but can't find way to test connection to db like for instance how i would test it with my mysql, here is script i normally use for mysql: <a href="https://gist.github.com/chales/11359952" rel="nofollow">https://gist.github.com/chales/11359952</a>. </p>
  
  <p>How can i test connection to mongo db with php script? I have tried to accomplish this with php script but not sure what functions to call:</p>
  
  <pre><code>    $m = new MongoClient('ip address of server');
      $db = $m-&gt;selectDB('dbname');
      $collection = new MongoCollection($db, 'collectionname');
  </code></pre>