Skip to content

Filtering & WHERE operators

List operations accept a type-safe where clause. A field maps either to a direct value (equality) or to an operator object. Operators are validated at compile time — e.g. string-only operators reject non-string columns, and JSONB operators are only offered on object/unknown columns.

await sdk.users.list({
where: {
status: "active", // direct value → equality
age: { $gte: 18, $lt: 65 }, // operator object
name: { $ilike: "%alice%" }, // case-insensitive LIKE
$or: [{ role: "admin" }, { role: "owner" }],
},
});

Use these inside an operator object on a single column.

OperatorDescription
$eqEqual to
$neNot equal to
$gtGreater than
$gteGreater than or equal to
$ltLess than
$lteLess than or equal to
$inIn array
$ninNot in array
$likeLIKE pattern match (strings only)
$ilikeCase-insensitive LIKE (strings only)
$similarityTrigram similarity match - “col” % value (pg_trgm required, uses similarity_threshold GUC)
$wordSimilarityWord trigram similarity match - value <% “col” (pg_trgm required)
$strictWordSimilarityStrict word trigram similarity match - value <<% “col” (pg_trgm required)
$isIS NULL
$isNotIS NOT NULL
$jsonbContainsJSONB contains (@>) - check if column contains the specified JSON structure
$jsonbContainedByJSONB contained by (<@) - check if column is contained by the specified JSON
$jsonbHasKeyJSONB has key (?) - check if top-level key exists
$jsonbHasAnyKeysJSONB has any keys (?|) - check if any of the specified keys exist
$jsonbHasAllKeysJSONB has all keys (?&) - check if all of the specified keys exist
$jsonbPathJSONB path query - query nested values. For multiple paths on same column, use $and

Combine field conditions. $or/$and nest up to two levels.

OperatorDescription
$orOR - at least one condition must be true
$andAND - all conditions must be true (alternative to implicit root-level AND)

Shape of the $jsonbPath operator value.

OperatorDescription
pathArray of keys to traverse (e.g., [‘user’, ‘preferences’, ‘theme’])
operatorOperator to apply to the value at the path (defaults to ‘$eq’)
valueValue to compare against