gpt4 book ai didi

sequelize.js - SequelizeDatabaseError : ER_BAD_FIELD_ERROR: Unknown column 'models.[object Object]' in 'where clause'

转载 作者:行者123 更新时间:2023-12-03 22:28:04 34 4
gpt4 key购买 nike

想要计算 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'

最佳答案

首先将 sequalize 更改为 sequelize :)

其次,您的 where 查询应如下所示:

where: sequelize.where(
sequelize.fn('ADDDATE', sequelize.col('updatedAt'), 5),
{
$lt: sequelize.fn('NOW')
}
)

关于sequelize.js - SequelizeDatabaseError : ER_BAD_FIELD_ERROR: Unknown column 'models.[object Object]' in 'where clause' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48802419/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com