P
Prisma•4w ago
Slyding

How can i string filter but for number?

Hey im still new to prisma and basically i want this getId Method to work: async test(id) this.prisma.idTable.findMany({ where: { id: {contains: id} }) but apparently it only works for strings and toString the id doesnt work aswell so helpp?
3 Replies
RaphaelEtim
RaphaelEtim•4w ago
Hi @Slyding 👋 if id is a number, you can simply do:
async test(id) {
return await this.prisma.idTable.findMany({
where: {
id: id
}
});
}
async test(id) {
return await this.prisma.idTable.findMany({
where: {
id: id
}
});
}
If your id field is a string and you want to use the contains filter.
Slyding
Slyding•4w ago
my id is a number but i want to fetch in my id table all rows where it contains the id. my problem is, where: { id: id only gives result if its the exact ID but i dont know thanks for the response tho! @RaphaelEtim
janglad
janglad•4w ago
Can you give some examples of the IDs? Out of interest, what’s the usecase for this
Want results from more Discord servers?
Add your server