Sails v12.14 connecting to MongoDB with Waterline
Is there a way to do a find query for all records created within the last 7 days from the current date? I've tried searching for an answer, but I'm guessing I'm not hitting the right keywords to come up with the answer I need.
For example, here's my function:
getOpen: function getOpen(req, res) {
Ticket.find({
status: "open",
open_date: [insert magic here]
}).then(function response(findModelResults) {
res.json(200, findModelResults);
})
.catch(function error(findModelError) {
sails.log.error('TicketController.getOpen', findModelError);
res.json(500, findModelError);
});
}
This works fine for pulling all tickets, but I'm not sure how to filter for only the last 7 days.