SupabaseS
Supabase4y ago
Amr

How do I check if any element of user input array exists in a column which is an array itself?

A user send an array like this [1, 2]
There's an existing row that has [1, 5]
I want to check if
1
exist in [1, 5]

I tried this code:
await supabase.from('reservations')
        .select()
        .eq('departureTripId', departureTripId)
        .containedBy('departureSeats', departureSeats);


But it doesn't return anything resulting in allowing for duplicate seats!
Was this page helpful?