I have an address and I want to see if it's in the db already, if not, create a new one. I know I can use findOrCreate() here, but let's make it easy and just check why I can't even find the existing address.
var address = {
name: req.body.name,
address1: req.body.address1,
address2: req.body.address2,
zip: req.body.zip,
city: req.body.city,
country: req.body.country,
user_id: req.body.user_id
};
Address.find({where: address}).then(function(result){
console.log(result);
}).catch(function(err){
console.error(err);
});
The generated query asks for ... AND user_id = NULLwhich is wrong. It should ask ... AND user_id IS NULL. How can I let sequelize do it right for me? Thanks.