title: MongoClient must be connected before calling MongoClient.prototype.db on Heroku
body: <p>Trying to connect to mongodb on MongoDB cloud from NodeJS app hosted on Heroku. Using mongodb ^3.2.3 and MongoDBClient, locally on my machine works great but after deployment to Heroku, getting the error above : "MongoError: MongoClient must be connected before calling MongoClient.prototype.db"</p>
  
  <pre><code>const uri = "mongodb+srv://myuser:mypass@mongodbcluster/test?retryWrites=true";
  const client = new MongoClient(uri, { useNewUrlParser: true });
  client.connect(err =&gt; {
      db = client.db("collection"); // &lt;-- this is where it fails
  ...
  </code></pre>