supabase-rb-rb
Database

Negate a filter

Negate the next filter in the chain.

Flips the negation flag on the builder so the next filter call is prefixed with not. on the wire. Apply this to any filter — eq, like, in_, is_, etc. — by chaining not_ immediately before it.

The method is named not_ because not is a reserved word in Ruby's parser.

Signature

builder.not_.<filter>(column, value)

Parameters

This method has no parameters. It mutates a one-shot flag on the builder and returns self; the very next filter call consumes the flag.

Returns

Returns
self (FilterRequestBuilder)

The same builder, with the negation flag set. The flag is cleared as soon as the next filter call runs.

Example — NOT eq

supabase
  .from("orders")
  .select("*")
  .not_.eq("status", "cancelled")
  .execute

# PostgREST receives status=not.eq.cancelled

Example — NOT in

supabase
  .from("countries")
  .select("name")
  .not_.in_("continent", ["Antarctica", "Oceania"])
  .execute

Example — NOT is null (find rows where a column is set)

supabase
  .from("users")
  .select("id, email, last_login_at")
  .not_.is_("last_login_at", nil)
  .execute

Example — NOT like

supabase
  .from("files")
  .select("path")
  .not_.like("path", "tmp/%")
  .execute

not_ sets a one-shot @negate_next flag that the next filter call consumes; if you call not_ and then never call a filter, nothing happens.

On this page