X
Xata8mo ago
Raveen

How to filter file column based on the size of the array with the TS SDK

xata.db.products.filter(images:, {$gt:1}) Is there something like this ?
2 Replies
kvch
kvch8mo ago
hi! unfortunately, it is not possible to filter like this.
tsg
tsg8mo ago
as a workaround, you can use something like this (using SQL over HTTP):
const res = await xata.sql`SELECT * FROM "products" WHERE jsonb_array_length(images) > ${1} LIMIT 10;`
const res = await xata.sql`SELECT * FROM "products" WHERE jsonb_array_length(images) > ${1} LIMIT 10;`
Want results from more Discord servers?
Add your server