ocelot2123
ocelot2123
Explore posts from servers
DTDrizzle Team
Created by ocelot2123 on 4/4/2024 in #help
Mysql compare json arrays
I have a column that is a json of array of strings. I'm trying to query based on array of strings as input like this:
// table schema
fileURLs: json("fileURLs").$type<string[]>().notNull(),

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

const fileURLs: string[] = ['abc.com'];
await db.query.table.findFirst({
where: and(
eq(table.fileURLs, fileURLs),
)
)
but its unable to find a object even though I know the exact record is in the DB, how should I approach with querying mysql jsons with drizzle? Should I just use raw sql?
1 replies