I recently ran in circles trying to figure out why my .sort call wasn’t behaving correctly.
Remember, “Sails.js is still in beta”, so it’s expected to have problems
The specific issue that bit me has to do with how the local disk database adaptor maintains timestamps.
“createdAt and updatedAt are not instances of Date”
You’ll have a problem when you try to sort a collection by createdAt. You would expect it to sort articles new to old or vice versa. In reality, because the dates are stored as strings, they’re sorted as strings — not dates.
Eventually these kinds of issues will get sorted out, but for now tread carefully when you use new frameworks like Sails.js