title: Mongoose .select is not a function when using with Azure Function
body: <p>I'm trying to use mongoose .select operator with my azure function but it keeps saying <code>TypeError: db.collection(...).findOne(...).select is not a function     at db.collection.find.toArray</code>
  It returns the user's data in the console, but doesn't filter it down with <code>.select</code>
  Why is that?</p>
  
  <pre><code>var MongoClient = require('mongodb').MongoClient;
  var Post = require('./model/post');
  var mongoose = require('mongoose');
  module.exports = async function (context, req) {
  
    let currentPage = 1;
  
  
    MongoClient.connect(process.env.CosmosDBConnectionString, async (err, client) =&gt; {
  
  
  
  
      let send = response(client, context);
  
      if (err) send(500, err.message);
  
      let db = client.db(process.env.dbName);
  
  
      await db.collection('listings').find(
        {
          $and: [
            { winnerHasBeenNotified: false },
            { auctionEndDateTime: { $lte: Date.now().toString() } }
          ]
        }
      )
  
        .toArray((err, result) =&gt; {
          console.log("result");
          console.log(result);
  
  
          if (result) {
  
            for (let i = 0; i &lt; result.length; i++) {
  
              db.collection('users').findOne(
                {
  
                  _id: mongoose.Types.ObjectId(result[i].bidderId)
  
                }
              ).select("notificationBy").toArray((err, result) =&gt; {
                console.log("USER RESULT!");
                console.log(result);
              });
  
  
            }
  
  
          }
  
  
  
  
          if (err) send(500, err.message);
          send(200, JSON.parse(JSON.stringify(result)));
  
  
  
        });
    });
  
  
  
  
  };
  
  function response(client, context) {
    return function (status, body) {
      context.res = {
        status: status,
        body: body
      };
  
      client.close();
      context.done();
    };
  }
  </code></pre>