Sequelize文档显示:
Post.findAll({
where: sequelize.where(sequelize.fn('char_length', sequelize.col('status')), 6)
});
我的查询:
models.appointment.findAll({
where: Sequelize.where(Sequelize.fn('char_length', Sequelize.col('department')), 6)
})
抛出错误:
Unhandled rejection Error: Invalid value Where {
attribute: Fn { fn: 'lower', args: [ [Object] ] },
comparator: '=',
logic: 6 }
使用Sequelize v4.42.x(最新)和mysql。为什么该查询会引发这样的错误?
答案 0 :(得分:1)
可以尝试吗?让我知道我在此post
找到了解决方案models.appointment.findAll({
where: Sequelize.where(Sequelize.fn('char_length', Sequelize.col('department')), '=',6)
})