not()

Match only rows which doesn't satisfy the filter.

Unlike most filters, opearator and value are used as-is and need to follow PostgREST syntax. You also need to make sure they are properly sanitized.

1const { data, error } = await supabase
2  .from('countries')
3  .select()
4  .not('name', 'is', null)

Parameters#

  • columnrequired
    ColumnName

    The column to filter on

  • operatorrequired
    FilterOperator

    The operator to be negated to filter with, following PostgREST syntax

  • valuerequired
    object

    The value to filter with, following PostgREST syntax

Notes#

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

1.not('id', 'in', '(5,6,7)')  // Use `()` for `in` filter
2.not('arraycol', 'cs', '{"a","b"}')  // Use `cs` for `contains()`, `{}` for array values

Examples#

With select()#

1create table
2  countries (id int8 primary key, name text);
3
4insert into
5  countries (id, name)
6values
7  (1, 'null'),
8  (2, null);