I am trying to run findOne query with 'where or' but why always return on the catch with empty error without console log error?
{
"message": "query is fail",
"err": {}
}
My code is below:
const Op = Sequelize.Op;
User.findOne({
where:
{
[Op.or]: [
{
'username': req.body.username
},
{
'email': req.body.email
}
]
}, logging: console.log
}).then(function (user) {
return res.status(200).send({'message': "query is success"});
}).catch(function (err) {
return res.status(400).send({'message': 'query is fail',err});
});
I think my code is right as in the docs and also other tutorials