printEmployees: async(company) => {
    var employees = await self.orderEmployees(company);
    // SECOND CONSOLE.LOG
    console.log(employees);
  },

  orderEmployees: (companyID) => {
    User.find({company:companyID})
    .exec()
    .then((employees) => {
      // FIRST CONSOLE.LOG
      console.log(employees);
      return employees;
    })
    .catch((err) => {
      return 'error occured';
    });
  },
Copy the code

Error model

  1. Need to return the User. The find…

  2. If a return error is an error, it is best to either a) ignore the error and let the upper try catch catch, or b) throw a new error instead of a return

  3. Note the need for await necessary.exec ()

  1. But Query can then, which is one of the many oddities of Mongoose