Skip to main content
Version: v2 RC

containedBy()

Only relevant for jsonb, array, and range columns. Match only rows where every element appearing in column is contained by value.

const { data, error } = await supabase
.from('classes')
.select('name')
.containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])

Parameters

  • columnrequiredColumnName

    The jsonb, array, or range column to filter on

  • valuerequiredstring | Record | array

    The jsonb, array, or range value to filter with

      Properties
    • objectrequiredobject

      No description provided.

    • stringrequiredobject

      No description provided.

    • Recordrequiredobject

      No description provided.

Examples

On array columns

const { data, error } = await supabase
.from('classes')
.select('name')
.containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])

On range columns

Postgres supports a number of range types. You can filter on range columns using the string representation of range values.

const { data, error } = await supabase
.from('reservations')
.select()
.containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)')

On jsonb columns

const { data, error } = await supabase
.from('users')
.select('name')
.containedBy('address', {})