What's the difference between the `contains` and `...
# help
r
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
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
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
Postgres provides a one line example:
n
robin (2022-04-08)
g
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
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
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
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
Thread was archived by @robin. Anyone can send a message to unarchive it.