I'm having this problem when I want to check if I have at least one record with the parameters. With 2 filters it works fine, but with 3 it's not working.
await prismaClient.t_endereco
.findFirst({
where: {
logradouro, (string)
bairro, (string)
numero, (number)
},
})
the condition to update the record is not having another identical.
i tried to use AND too:
await prismaClient.t_endereco
.findFirst({
where: {
AND:[
{logradouro},
{bairro},
{numero},
]
},
})
same issue.
someone to help me with this?
You can try the follow:
const { PrismaClient } = require('@prisma/client')
const prisma = new PrismaClient()
prisma.category.findFirst({
where: {
OR: [
{ id: 2 },
{ name: 'new' },
{ description: 'd1' },
],
},
})
.then(data => {
console.log(data)
})
.catch(error => {
console.error(error)
})