TypeORM find where子句,如何在多个参数中添加where
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']
});
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']
});