Skip to main content
Version: v2 RC

or()

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.

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

Parameters

  • filtersrequiredstring

    The filters to use, following PostgREST syntax

  • foreignTablerequiredobject

    Set this to filter on foreign tables instead of the current table

      Properties
    • foreignTableoptionalstring

      No description provided.

Examples

With select()

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

Use or with and

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

Use or on foreign tables

const { data, error } = await supabase
.from('countries')
.select(`
name,
cities!inner (
name
)
`)
.or('country_id.eq.1,name.eq.Beijing', { foreignTable: 'cities' })