Complex database queries in Sails.js

How can I do complex database queries such as joins using Sails.js?

I tried the generate method using the command line, it's great and I connected it to my MySQL database and it works great, but now what I need to understand is how I can do complex SELECT statements. I can't find it in the documentation.

For complicated queries refer to this answer by particlebanana, one of Sails.js core contributors.

As an alternative to perform joins, you can use the associations branch.