Drizzle Mysql compare json arrays

I have a column that is a json of array of fileURLs (string). I'm trying to query based on array of urls as input like this:
// table schema
fileURLs: json("fileURLs").$type<string[]>().notNull(),

const fileURLs: string[];
await db.query.table.findFirst({
where: and(
eq(table.fileURLs, fileURLs),
)
)
// table schema
fileURLs: json("fileURLs").$type<string[]>().notNull(),

const fileURLs: string[];
await db.query.table.findFirst({
where: and(
eq(table.fileURLs, fileURLs),
)
)
but its unable to find a object, how should I approach with querying mysql jsons with drizzle? Should I just use raw sql?
4 Replies
Neto
Neto7mo ago
using equals on postgres works just fine, should be the same for mysql as well
No description
Neto
Neto7mo ago
No description
Neto
Neto7mo ago
you can use raw drizzle with json operators as well
Neto
Neto7mo ago
No description
Want results from more Discord servers?
Add your server