how to use TypeOrm to search for multiple rows containing any one of the mulitiple items in same Column?

900 Views Asked by At

i have a typeorm + postgresql + node setup.

My users table has these fields

 __________________________
| name | email    | phone |
 __________________________
| n1   | [email protected] | 1234   |
 __________________________
| n2   | [email protected] |  2983 |
 __________________________
| n3  |  [email protected] | 0933 |
 __________________________

.....and so on...

if i want to get a row i can use this expression ,

Repository.find({
where: { email : '[email protected]'},
})

But if i want to get all rows which has different email addresses, how can i do that? ie. where email === [email protected] || email === [email protected] || .... (the problem is that, we dont know these emails beforehand...the emails can vary... means sometimes we may need to use a group of emails, and some other time, a totally different group of emails etc..it comes from another database select operation)

anyideas on how to do that in TypeOrm?... if a solution is possible with out queryRunner or querybuilder, it will be more easier for a beginner like me..

0

There are 0 best solutions below