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( sqlSELECT * 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
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server