title: Avoid "current URL string parser is deprecated" warning by setting useNewUrlParser to true
body: <p>I have a database wrapper class that establishes a connection to some MongoDB instance:</p>
  
  <pre><code>async connect(connectionString: string): Promise&lt;void&gt; {
          this.client = await MongoClient.connect(connectionString)
          this.db = this.client.db()
  }
  </code></pre>
  
  <p>This gave me a warning:</p>
  
  <blockquote>
    <p>(node:4833) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.</p>
  </blockquote>
  
  <p>The <code>connect()</code> method accepts a <code>MongoClientOptions</code> instance as second argument. But it doesn't have a property called <code>useNewUrlParser</code>. I also tried to set those property in the connection string like this: <code>mongodb://127.0.0.1/my-db?useNewUrlParser=true</code> but it has no effect on those warning. </p>
  
  <p>So how can I set <code>useNewUrlParser</code> to remove those warning? This is important to me since the script should run as cron and those warnings result in trash-mail spam. </p>
  
  <p>I'm using <code>mongodb</code> driver in version <code>3.1.0-beta4</code> with corresponding <code>@types/mongodb</code> package in <code>3.0.18</code>. Both of them are the latest avaliable using <code>npm install</code>.</p>
  
  <h3>Workaround</h3>
  
  <p>Using an older version of mongodb driver:</p>
  
  <pre><code>"mongodb": "~3.0.8",
  "@types/mongodb": "~3.0.18"
  </code></pre>