Database
Contained by value
Match rows whose array, range, or jsonb column is contained by the supplied value.
Filter rows where column <@ value (PostgreSQL "contained by"). The inverse of contains. Auto-serializes the same way.
Signature
builder.contained_by(column, value)Parameters
| Name | Type | Required | Description |
|---|---|---|---|
column | String / Symbol | Required | Column name. |
value | String / Hash / Array / Enumerable | Required | Superset 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. |
Returns
Returns
self (FilterRequestBuilder)
The same builder for chaining.
Example — array column
# Match rows whose tags are entirely a subset of the supplied list.
supabase
.from("posts")
.select("id, title, tags")
.contained_by("tags", ["ruby", "supabase", "postgrest", "rails"])
.executeExample — range column
# Match rows whose `during` range fits inside June 2026.
supabase
.from("bookings")
.select("*")
.contained_by("during", "[2026-06-01,2026-07-01)")
.executeExample — jsonb column
supabase
.from("preferences")
.select("*")
.contained_by("settings", { theme: "dark", density: "compact" })
.executeThe operand is auto-serialized the same way as contains. PostgREST receives column=cd.<value>.