title: .aggregate(...).toArray is not a function
body: <p>here is the code I am getting the error on.
  I have tried multiple ways but keet getting the same error.
  TypeError: _user10.default.aggregate(...).toArray is not a function
  I searched for other answers but they are mongodb not mongoose
  ex  db.collection('users').aggregate
  any assistance would be greatly appreciated</p>
  
  <pre><code>import User from './user.model';
  import socket from './../../CHATtest/web/socket.js';
  
  
  
  getUserInfo({userId,socketId = false}){
      let queryProjection = null;
      if(socketId){
          queryProjection = {
              "socketId" : true
          }
      } else {
          queryProjection = {
              "username" : true,
              "online" : true,
              '_id': false,
              'id': '$_id'
          }
      }
      return new Promise( async (resolve, reject) =&gt; {
          try {
      //const result = await User.aggregate([{
      //await User.aggregate([{
      User.aggregate([{
      //DB.collection('users').aggregate([{
                  $match:  {
                      _id : userId
                  }
              },{
                  $project : queryProjection
              }
    ]).toArray( (err, result) =&gt; {
                  if( err ){
                      reject(err);
                  }
                  socketId ? resolve(result[0]['socketId']) : resolve(result);
              });
          } catch (error) {
              reject(error);
          }
      });
  },
  </code></pre>