【发布时间】:2020-08-19 13:59:12
【问题描述】:
var where = {
[Op.or]:
[
{ status: { [Op.ne]: 'disable' } },
{ status: { [Op.eq]: null } }
],
}
db.diagnostic.findAll({ where: where }).then(resp => {
res.send(resp)
})
上面的代码正在运行
但是,
var where = {
status: { [Op.ne]: 'disable' } // I want use only this code instead of `or`
}
db.diagnostic.findAll({ where: where }).then(resp => {
res.send(resp)
})
我只想使用status: { [Op.ne]: 'disable' }
【问题讨论】:
-
出了什么问题?在第二种情况下,您将在 SQL 中得到类似:(title ilike '%seach_value%' OR ...) AND status 'disable'。这不是你想要达到的吗?
-
我不明白你到底想要达到什么目的
标签: sql node.js sequelize.js where-clause