【发布时间】:2018-08-31 15:06:29
【问题描述】:
Sails v12.14 使用 Waterline 连接到 MongoDB
有没有办法对从当前日期起最近 7 天内创建的所有记录进行查找查询?我尝试过寻找答案,但我猜我没有找到正确的关键字来找到我需要的答案。
例如,这是我的函数:
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);
});
}
这适用于提取所有票证,但我不确定如何仅过滤过去 7 天。
【问题讨论】:
标签: javascript sails.js waterline sails-mongo