biggora / caminte

Cross-db ORM for NodeJS
http://www.camintejs.com/
MIT License
1.08k stars 119 forks source link

OR clause in where condition not working #208

Open sgda021992 opened 5 years ago

sgda021992 commented 5 years ago

Hi,

I have a query like (Select * from users where user.name='asd' OR user.lastname = 'asdaff')

I have written my code like this:-

Users.findOne( { where: { or: [ { name: req.params.name }, { lastname: req.params.lastname } ] } }, function (err, user) { if(user) { done(user, null); } else { done(null, err); } });

but it's not working throwing me error null. Can u tell me how can i achieve this.