title: mongodb-nodejs-driver, DeprecationWarning: collection.count is deprecated
body: <p>I want to get the count of posts documents using:</p>
  <pre class="lang-js prettyprint-override"><code>db.collection('posts').count()
  </code></pre>
  <p>But, I got a warning:</p>
  <blockquote>
  <p>DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use collection.countDocuments or collection.estimatedDocumentCount instead</p>
  </blockquote>
  <p>Here is my mongodb nodejs driver version:</p>
  <pre><code>  &quot;dependencies&quot;: {
      &quot;mongodb&quot;: &quot;^3.1.0&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@types/mongodb&quot;: &quot;^3.1.0&quot;,
      &quot;chai&quot;: &quot;^4.1.2&quot;,
      &quot;mocha&quot;: &quot;^5.1.1&quot;,
      &quot;ts-node&quot;: &quot;^7.0.0&quot;,
      &quot;tslint&quot;: &quot;^5.10.0&quot;,
      &quot;typescript&quot;: &quot;^2.9.2&quot;
    }
  </code></pre>
  <p>There is no <code>countDocuments</code> or <code>estimatedDocumentCount </code> in <code>index.d.ts</code> file.</p>
  <p>How can I solve this warning?</p>