Skip to main content

.not()

Finds all rows which doesn't satisfy the filter.

const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.not('name', 'eq', 'Paris')

Parameters

  • columnrequiredobject

    The column to filter on.

  • operatorrequiredFilterOperator

    The operator to filter with.

  • valuerequiredany

    The value to filter with.

Notes

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

      .not('name','eq','Paris')
    .not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains.
    .not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column.
    .not('id','in','(6,7)') // Use Postgres list () for in filter.
    .not('id','in',`(${arr})`) // You can insert a javascript array.

Examples

With select()

const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.not('name', 'eq', 'Paris')

With update()

const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.not('name', 'eq', 'Paris')

With delete()

const { data, error } = await supabase
.from('cities')
.delete()
.not('name', 'eq', 'Paris')

With rpc()

// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
.rpc('echo_all_cities')
.not('name', 'eq', 'Paris')