Checking Null or empty list

I have a field of type integer list in my DB. I want to add a filter if is empty or null,
{
OR: [
{ myList: { isEmpty: true } },
{ myList: { equals: null } }
]
}
{
OR: [
{ myList: { isEmpty: true } },
{ myList: { equals: null } }
]
}
But I am getting this error
Argument `equals`: Invalid value provided. Expected Null, provided (Null)."
Argument `equals`: Invalid value provided. Expected Null, provided (Null)."
I had tried a lot of the stuff already, but I don't know how to fix this error, any help pls?
3 Replies
RaphaelEtim
RaphaelEtim4w ago
Hi @Dobleuber Can you try this ?
import { Prisma } from '@prisma/client'

{
OR: [
{ myList: { isEmpty: true } },
{ myList: { equals: Prisma.DbNull } }
]
}
import { Prisma } from '@prisma/client'

{
OR: [
{ myList: { isEmpty: true } },
{ myList: { equals: Prisma.DbNull } }
]
}
See this documentation https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types/working-with-json-fields#filtering-by-null-values
Working with Json fields (Concepts) | Prisma Documentation
How to read, write, and filter by Json fields.
Dobleuber
DobleuberOP4w ago
I tried already, It didn’t work.
RaphaelEtim
RaphaelEtim4w ago
Can you please share your schema
Want results from more Discord servers?
Add your server