不使用 querybuilder 的 Typeorm 和运算符
Typeorm and operator without using querybuilder
在 NestJS / Typeform 中,我想进行一个查询,将条件作为 AND
条件。
我试过这样的东西
async getByUniqueConstraints(user: User){
const {email, phoneNumber} = user
const foundUser = await this.userRepository.findOne({where: [email, phoneNumber], });
}
问题在于它使用了 OR
条件。有没有办法在不使用查询构建器或任何更高级的概念的情况下将其与 AND
运算符一起使用?
where
大括号中的字段使用 AND 运算符。您可以在此处的文档中看到它:https://github.com/typeorm/typeorm/blob/master/docs/find-options.md
在 NestJS / Typeform 中,我想进行一个查询,将条件作为 AND
条件。
我试过这样的东西
async getByUniqueConstraints(user: User){
const {email, phoneNumber} = user
const foundUser = await this.userRepository.findOne({where: [email, phoneNumber], });
}
问题在于它使用了 OR
条件。有没有办法在不使用查询构建器或任何更高级的概念的情况下将其与 AND
运算符一起使用?
where
大括号中的字段使用 AND 运算符。您可以在此处的文档中看到它:https://github.com/typeorm/typeorm/blob/master/docs/find-options.md