.or()
Finds all rows satisfying at least one of the filters.
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.or('id.eq.20,id.eq.30')
Parameters
filtersrequired
string
The filters to use, separated by commas.
__namedParametersrequired
object
No description provided.
foreignTablerequired
undefined
|string
The foreign table to use (if
column
is a foreign column).
Properties
Notes
.or()
expects you to use the raw PostgREST syntax for the filter names and values..or('id.in.(6,7), arraycol.cs.{"a","b"}') // Use Postgres list () for in filter. Array {} for array column and 'cs' for contains.
.or(`id.in.(${arrList}),arraycol.cs.{${arr}}`) // You can insert a javascipt array for list or array on array column.
.or(`id.in.(${arrList}),rangecol.cs.[${arrRange})`) // You can insert a javascipt array for list or range on a range column.
Examples
With select()
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.or('id.eq.20,id.eq.30')
Use or
with and
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.or('id.gt.20,and(name.eq.New Zealand,name.eq.France)')
Use or
on foreign tables
const { data, error } = await supabase
.from('countries')
.select('id, cities(*)')
.or('name.eq.Wellington,name.eq.Paris', { foreignTable: "cities" })