Database
Column contains every element in a value
Match rows whose array, range, or jsonb column contains the supplied value.
Filter rows where column @> value (PostgreSQL "contains"). Works on array, range, and jsonb columns — the method shape-detects the argument and serializes it appropriately.
Signature
builder.contains(column, value)Parameters
| Name | Type | Required | Description |
|---|---|---|---|
column | String / Symbol | Required | Column name. |
value | String / Hash / Array / Enumerable | Required | Containment operand. Hash and non-Array Enumerables are JSON-encoded for jsonb columns; Arrays are wrapped as {a,b,c} for array columns; Strings are passed through verbatim (use this for raw PostgREST range/array literals). |
Returns
Returns
self (FilterRequestBuilder)
The same builder for chaining.
Example — array column
# tags is text[] — match rows whose tags include all of these.
supabase
.from("posts")
.select("id, title, tags")
.contains("tags", ["ruby", "supabase"])
.executeExample — jsonb column
# metadata is jsonb — match rows whose metadata includes { plan: "pro" }.
supabase
.from("organizations")
.select("*")
.contains("metadata", { plan: "pro" })
.executeExample — range column
# during is a tstzrange — match rows whose range fully contains [2026-06-01, 2026-06-02).
supabase
.from("bookings")
.select("*")
.contains("during", "[2026-06-01,2026-06-02)")
.executeArray is auto-serialized to {a,b,c} and Hash to JSON. PostgREST receives column=cs.<value>.