© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
DT
Drizzle Team
•
3y ago
G O A T
How to Access an array of strings in jsonb format
I am trying to find records where slug
(predefined variable
) is found in an array in my jsonb players column
. The value looks like this
:
[
'John
'
,
'James
'
,
'Joe
'
,
'Jack
'
]
If slug
= John then this should return the record
.
My below query does not work
:
const result
= await db
.execute
(
sql
SELECT * FROM ${table} WHERE ${table.players}::jsonb ? ${slug}
SELECT * FROM ${table} WHERE ${table.players}::jsonb ? ${slug}
)
;
I get this error
:
ERROR
: operator does not exist
: jsonb
? record
HINT
: No operator matches the given name and argument types
. You might need to add explicit type casts
.
Any suggestions would be really helpful
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Drizzle failed to parse an empty JSONB Array
DT
Drizzle Team / help
2y ago
array of number returning strings
DT
Drizzle Team / help
2y ago
sql operator with array of strings
DT
Drizzle Team / help
2y ago
malformed array literal when trying to insert a 2d array of strings
DT
Drizzle Team / help
15mo ago