想要计算updatedAt列,然后将其与where子句
中的当前日期进行比较const query = {
where: {
[sequalize.fn('ADDDATE', sequalize.col('updatedAt'), 5)]:
{
$lt: sequalize.fn('NOW'),
},
},
force: true,
};
错误:SequelizeDatabaseError: ER_BAD_FIELD_ERROR: Unknown column 'models.[object Object]' in 'where clause'
答案 0 :(得分:1)
首先将sequalize
更改为sequelize
:)
其次,您的where
查询应如下所示:
where: sequelize.where(
sequelize.fn('ADDDATE', sequelize.col('updatedAt'), 5),
{
$lt: sequelize.fn('NOW')
}
)