https://supabase.com/ logo
#help
Title
# help
r

robin

04/08/2022, 8:16 PM
What's the difference between the
contains
and
containedBy
filters? The documentation doesn't say what the examples would return, so it's not super helpful 😦
n

Needle

04/08/2022, 8:16 PM
Hello @robin! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
r

robin

04/08/2022, 8:22 PM
oh I guess
contains
is to select rows for which an array column contains a given value, while
containedBy
is to select rows for which the value of a column exists in a given array
g

garyaustin

04/08/2022, 8:36 PM
Postgres provides a one line example:
n

Needle

04/08/2022, 8:36 PM
robin (2022-04-08)
g

garyaustin

04/08/2022, 8:38 PM
contains for sure means your column array must have all of your filter array items in it. containedby I believe means all items in your column array must be in your filter array, but I have not used containedby.
r

robin

04/08/2022, 9:03 PM
hmmm
okay. It's a bit confusing because it's not clear which, of the column value or the provided filter, 'contains' or 'is contained by' the other
g

garyaustin

04/08/2022, 9:06 PM
In the js client the first item is column and will be on left, 2nd item is filter array and will be on right in above. Just glanced at source code and column has to be first one.
r

robin

04/09/2022, 6:01 PM
I got it to work btw @garyaustin thanks, one issue I couldn't figure out initially is that both these filters require an array column, I wanted to check a column that had single values so needed to use
in
instead
n

Needle

04/09/2022, 6:01 PM
Thread was archived by @robin. Anyone can send a message to unarchive it.