I just started using Sails.js with its ORM, Waterline, and absolutely love it, but I am not sure how to use query modifiers for dates. I am using sails-mysql. Specifically, I am trying to get rows that have a datetime field between two specific dates. I have tried doing this:
MyModel.find()
.where({ datetime_field: { '>=': startDate } })
.where({ datetime_field: { '<=': endDate } })
.done(function(err, objects){
// ...
});
startDate
and endDate
are two Date
objects. I have also tried converting them to strings with toString()
. In both cases, I get every row from the database instead of rows between the two dates. Is there a way to do this or is this functionality not yet part of either Waterline or sails-mysql?