3

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?

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.