[英]TypeORM find where clause, how to add where in multiple parameter
this.sampleRepo.find (
{
where: {
id: In ["1","7","13"]
}
order: {
id: "DESC"
},
select: ['id','group']
}
);
如何在此處添加 where 子句,以便我只能找到用戶 ID 為 1 或 7 或 13 的記錄。
您錯過了圓括號,並且可能錯過了導入In
運算符:
import { In } from 'typeorm';
...
...
...
this.sampleRepo.find({
where: {
id: In(['1', '7', '13'])
},
order: {
id: 'DESC'
},
select: ['id', 'group']
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.