Monthly Archives: March 2016

How to print all SQL Queries made by waterline (Sails.js ORM)

The ORM used by sails.js is called waterline. I have been playing around with it for a couple of days now and noticed some subtle bugs, especially when associations are involved.

Fortunately, you can enable logging of all queries to the (server) console by setting the environment variable LOG_QUERIES to true when lifting sails:

$ LOG_QUERIES=true sails lift

This makes it much easier to figure out if strange behavior is caused by a bug in your own code or in waterline itself.