【发布时间】:2016-10-10 18:40:14
【问题描述】:
我想通过元素的时间戳过滤数据库表。
表格有行: ID、URL、时间表。
如何通过某个范围内的时间戳过滤数据? 像往常一样在 SQL ... BETWEEN firstTime 和 lastTime
我尝试了类似的东西:
if (first_date && last_date) {
Pages.forge()
.where("Date", '>=' , first_date)
.where("Date", '<=' , last_date)
.fetchAll()
.then(function (pages) {
res.send(persons.toJSON());
}).catch(function (error) {
console.log(error);
res.send('An error occured');
});
【问题讨论】:
-
运行该代码时发生了什么?你期望会发生什么?
-
试试这个问题的答案。 stackoverflow.com/questions/41417730/…
标签: node.js bookshelf.js