Check array contains
Hello, what's the correct way to check if an array doesn't have a value? I'm doing this right now but it's not working:
Both are Int[] arrays and are empty right now, so this should work I think
8 Replies
You're in no rush, so we'll let a dev step in. Enjoy your coffee, or drop into
#ask-ai
if you get antsy for a second opinion!Hey 👋
If I understand correctly you want to check if the array is empty or not, right?
Would something like isEmpty work for you?
https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays#null-values-in-arrays
Working with scalar lists/arrays (Concepts) | Prisma Documentation
How to read, write, and filter by scalar lists / arrays.
hello, no I wish to check if the array doesn't have the value already
both left and right arrays must not contain level
@Nurul (Prisma) sorry to ping but is this not possible?
Ah, okay!
In that case what you are doing seems correct.
As per our official example, this should work:
https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays#null-values-in-arrays
Working with scalar lists/arrays (Concepts) | Prisma Documentation
How to read, write, and filter by scalar lists / arrays.

yes it's not working for some reason sadly
is it because the array is empty?
Can you provide a small reproduction so that I can try?
I managed to fix it just now, I realized there was no AND after the NOT 😅
sorry about that
Ah! Nice catch! I am glad to hear that you managed to fix it 🙌