Nodejs书架。 如何使用BETWEENfilter

我想通过元素的timeStamp过滤数据库表。

表中有行: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'); }); 

 model.query({where: {"Date", '>=' , first_date}, orWhere: {"Date", '<=' , last_date}}) .fetch() .then(function(model) { // ... }); 

你必须使用where和where,例如:between表示两个条件中的任何一个,但是在这里你设置为条件为真。