Eliezer Wohl
Eliezer Wohl

Reputation: 607

Trying to search two columns using sequelize

I'm trying to search a two columns in a mysql table using sequelize, using the same term. So for instance, I want to search in a table called users, columns of first name and lastname, using a var called user input. I've only managed to make it's either first and last, rather than first OR last. How would I preform this query?

Upvotes: 1

Views: 1743

Answers (1)

Nhor
Nhor

Reputation: 3940

You might want to check out the docs: http://docs.sequelizejs.com/en/latest/docs/querying/#where

Basically what you need to do is to use an $or operator in a query:

$or: [{a: 5}, {a: 6}]  // (a = 5 OR a = 6)

Upvotes: 1

Related Questions