Skip to content

JSONB Queries

Check if a JSONB column contains a value:

pulsabase.from(User)
.where('metadata', { $jsonb_contains: { role: 'admin' } })
.find();

Check if a JSONB column has a specific key:

pulsabase.from(User)
.where('preferences', { $jsonb_has_key: 'theme' })
.find();
pulsabase.from('users')
.where('preferences', jsonbHasAnyKey(['lang', 'timezone']))
.find();
OperatorDescriptionDart Helper
$jsonb_containsJSONB @> valuejsonbContains(value)
$jsonb_has_keyJSONB ? keyjsonbHasKey(key)
$jsonb_has_any_keysJSONB ?| keysjsonbHasAnyKey(keys)