typeorm "OR" operator typeorm "OR" operator sql sql

typeorm "OR" operator


db.getRepository(MyModel).find({  where:[      {name:"john"},      {lastName: "doe"}  ]})

Pass an array to where


I had the same issue, but I worked around it with the QueryBuilder.

This would be an example.

return await getRepository(MyModel)  .createQueryBuilder()  .where("name = :name OR lastName = :lastName", {    name: "john",    lastName: "doe"  })  .getMany();