hello fellows, someone knows hows the best way to ...
# orm-help
p
hello fellows, someone knows hows the best way to filter integers like "contains" for strings?
γ
You can use the
.toString()
function and then
.includes()
. For example:
Copy code
537.toString().includes("37")
p
I think you misunderstood. This is an example:
const ncms = await prisma.ncms.findMany({
select: {
id: true,
number: true,
description: true
},
where: {
OR: [
{
number: { equals: parseInt(text) }
},
{
description: { contains: text }
}
]
}
})
I would like to filter the number column (that is integer) like "contains". In SQL (mysql), I would use CAST and wildcards to change it the type on execution.
γ
No, unfortunately there is not a way to do what you want to accomplish. However, there is a
notIn
operator, that may be useful
p
Yeah, thats exactly what I thought. I did some research last week and found nothing too. My solution will be using the raw way. Thank you!
🙂 1