我尝试使用以下 Sequelize 代码从数据库 mysql 获取一些值:
subSector
.sync()
.then(() => subSector.findAll({
Where: {
Enterprise_Evaluation_ID: 2
}
}))
.then(result => {
console.log(result)
})
.catch(error => {
console.log(error)
})
}
问题是sequelize获取表的所有值,而不仅仅是条件where的数据。
有什么想法吗?
我们最近更改了AWS中的服务器项目(将elasticbeanstalk更改为其他实例eb)
最佳答案
我能找到的唯一问题是,Where
应该是小写,如where
subSector.findAll({
Where: {
Enterprise_Evaluation_ID: 2
}
})
将其更改为:
subSector.findAll({
where: { // <--------- HERE
Enterprise_Evaluation_ID: 2 // <--------- Also make sure the field name is proper
}
})
关于mysql - Sequelize 获取查询的所有数据而不执行我的条件 'where',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52529023/