0

I'm using Sails.js and thus, Waterline and I'm wondering if the following is possible?

teamFind: function(req,res,next){
 User.find().skip(req.param('listPage')).limit(26).sort('school').sort('officialUser').exec(function(err,users){
      res.view({
        teams:users,
        nextPage: parseInt(req.param('listPage'),10)+26
      });
    });
  },

What I'm wanting to do is return the users sorted by school and then move the "Official Users" to the top of that list. Currently this just returns everything in alphabetic order. Is the issue that 'officialUser' is a boolean?

gregdillon
  • 23
  • 4

1 Answers1

0

Solved! The main issue was that I had objects I wanted to sort in the wrong order. Also, I needed to add 'desc' to the 'officialUser' sort.

gregdillon
  • 23
  • 4