title: Mongo and Node.js find and aggregate
body: <p>I'm using Node.js and MongoDB and I need to use the functions "find" and "aggregate" togheter. For example:</p>
  
  <pre><code>var mongo = require('mongodb')
  mongo.MongoClient.connect(uri, {
    useNewUrlParser: true }, function(errorConectDB, client) {
       dbo.collection(this._objectName).find(query,options).aggregate(agr).toArray(function(err,
           res) {....}) })
  </code></pre>
  
  <p>However, when I execute my code the following error appears:</p>
  
  <p>TypeError: dbo.collection(...).find(...).aggregate is not a function</p>
  
  <p>Is there any way to fix it? Do you recommend any other alternative?</p>