JavaScript: Match at least one filter

Match only rows which satisfy at least one of the filters.

Unlike most filters, filters is used as-is and needs to follow PostgREST syntax. You also need to make sure it's properly sanitized.

It's currently not possible to do an .or() filter across multiple tables.

or() expects you to use the raw PostgREST syntax for the filter names and values.

.or('id.in.(5,6,7), arraycol.cs.{"a","b"}')  // Use `()` for `in` filter, `{}` for array values and `cs` for `contains()`.
.or('id.in.(5,6,7), arraycol.cd.{"a","b"}')  // Use `cd` for `containedBy()`

Parameters

Examples

With `select()`

const { data, error } = await supabase
  .from('characters')
  .select('name')
  .or('id.eq.2,name.eq.Han')

Use `or` with `and`

const { data, error } = await supabase
  .from('characters')
  .select('name')
  .or('id.gt.3,and(id.eq.1,name.eq.Luke)')

Use `or` on referenced tables

const { data, error } = await supabase
  .from('orchestral_sections')
  .select(`
    name,
    instruments!inner (
      name
    )
  `)
  .or('section_id.eq.1,name.eq.guzheng', { referencedTable: 'instruments' })