Typeorm and operator without using querybuilder

In NestJS / Typeform I want to make a query that sues to conditions as an AND condition.

I tried something like this

 async getByUniqueConstraints(user: User){
        const {email, phoneNumber} = user
        const foundUser = await this.userRepository.findOne({where: [email, phoneNumber], });

    }

The problem with this is that it uses an OR condition. Is there a way to use this with an AND operator instead without using a querybuilder or any more advanced concepts?

Upvotes: 2

Views: 13690

Answers (1)

ruciu
ruciu

Reputation: 712

where with fields in curly braces uses AND operator. You can see it in docs here: https://github.com/typeorm/typeorm/blob/master/docs/find-options.md

Upvotes: 3

Related Questions