【发布时间】:2014-06-17 16:27:06
【问题描述】:
我正在使用带有 sqlite3 的 Sequelize,但在查询基于“日期”类型列的数据时遇到问题。
这是我的模型定义:
var sensorData = sequelize.define('Data',
{
time: Sequelize.DATE,
value: Sequelize.FLOAT,
type: Sequelize.STRING,
source: Sequelize.STRING
},
{
timestamps : false
});
现在我想在这个函数中获取所有“时间”晚于给定时间的记录:
function selectData(start_date, num_of_records, callback)
{
sensorData.findAll({
limit: num_of_records,
where: [time, '???'], <====== How to specify the condition here?
order: 'time'}).success(callback);
}
我在 Sequelize 的网站上找不到任何关于基于“日期”类型的查询语句的信息。
有什么想法吗?
【问题讨论】:
-
你试过
where: {time: {gt: new Date(...)}}吗?
标签: node.js sqlite sequelize.js