title: MongoClient.connect doesn't execute callback function
body: <p>I'm relatively new to node.js. Trying to test connection to mongodb using mocha framework and mongodb driver.</p>
  
  <p>Node.js version - 6.11.3</p>
  
  <p>Mongodb driver version - 2.2.31</p>
  
  <p>Mondodb version - 3.4.7</p>
  
  <p>Here's my js file:</p>
  
  <pre><code>var should = require("should");
  var expect = require('chai').expect;
  var cfg = require('../config');
  var uri = cfg.mongouri;
  var MongoClient = require('mongodb').MongoClient, Logger = 
  require('mongodb').Logger;
  
  Logger.setLevel('debug');
  describe("mongoconnection", function () {
  
  describe("fetch data", function () {
  
      it("should fetch data from db", function (done) {
          MongoClient.connect(uri,function(err, db) {
                  if (err) {
                      throw err;
                  } else {
                      console.log("successfully connected to the database");
                  }
                  db.close();
              });
          done();
      });
  });
  });
  </code></pre>
  
  <p>However, this part of the code</p>
  
  <pre><code>function(err, db) {
              if (err) {
                  throw err;
              } else {
                  console.log("successfully connected to the database");
              }
              db.close();
          }
  </code></pre>
  
  <p>never gets executed and I can't establish connection, e.g. I don't get neither console log nor exception.</p>
  
  <p>Debug information:</p>
  
  <blockquote>
    <p>[DEBUG-Connection:9352] 1506430786041 creating connection 0 with options [{"host":HOST,"port":PORT,"size":5,"keepAlive":true,"keepAliveInitialDelay":300000,"noDelay":true,"connectionTimeout":30000,"socketTimeout":360000,"ssl":true,"ca":null,"crl":null,"cert":null,"rejectUnauthorized":false,"promoteLongs":true,"promoteValues":true,"promoteBuffers":false,"checkServerIdentity":true}] { type: 'debug',
      message: 'creating connection 0 with options [{"host":HOST,"port":PORT,"size":5,"keepAlive":true,"keepAliveInitialDelay":300000,"noDelay":true,"connectionTimeout":30000,"socketTimeout":360000,"ssl":true,"ca":null,"crl":null,"cert":null,"rejectUnauthorized":false,"promoteLongs":true,"promoteValues":true,"promoteBuffers":false,"checkServerIdentity":true}]',
      className: 'Connection',
      pid: 9352,
      date: 1506430786041 }</p>
  </blockquote>
  
  <p>also already checked that connection string is correct and I can establish connection to it via another app (groovy script executed in SoapUI).</p>
  
  <p>I am stuck at this point, can someone please help me with this, thanks in advance.</p>