P
Prisma•4mo 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•4mo 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
SlydingOP•4mo 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•4mo 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