Javascript AssertionError[ERR_ASSERTION]:选项参数中缺少where属性。芬德尔续集
我在sequelize中使用findAll检查网站的使用寄存器,但总是会收到错误消息:“AssertionError[ERR_ASSERTION]:options参数中缺少where属性”。我的代码非常简单,如下所示:Javascript AssertionError[ERR_ASSERTION]:选项参数中缺少where属性。芬德尔续集,javascript,sequelize.js,Javascript,Sequelize.js,我在sequelize中使用findAll检查网站的使用寄存器,但总是会收到错误消息:“AssertionError[ERR_ASSERTION]:options参数中缺少where属性”。我的代码非常简单,如下所示: var checkRegister = function (data, callback){ userModel.findAll({ 'where': { '$and': [ {'phoneNumber'
var checkRegister = function (data, callback){
userModel.findAll({
'where': {
'$and': [
{'phoneNumber' : data.phoneNumber},
{'password' :
{$ne : null }
}
]
}
}).then(callback).catch(function(e) {
console.log('find user error,', e);
throw e;
});
}
我的续集版本4.37.10,有人能给我一些建议吗?谢谢你的帮助。你不需要在
的where
中加引号,你也可以不用和。像这样的
var checkRegister = function (data, callback){
userModel.findAll({
where: {
phoneNumber: data.phoneNumber,
password: { [Op.ne]: null }
}
}).then(callback).catch(function(e) {
console.log('find user error,', e);
throw e;
});