SupabaseS
Supabase12mo ago
Maxim

Applying ilike to related entities

Hello, I've tried all kinds of variations so solve this but it didn't work. I have an express.js backend and I want to apply the ilike operator to filter a result set by values in sub-entities. Something like this:
let query = supabase
.from('shop_orders')
.select( *, line_items(*), order_shipments(*), shipping_address:addresses!shop_orders_shipping_address_id_fkey(*), billing_address:addresses!shop_orders_billing_address_id_fkey(*) , { count: 'exact' })
.eq('user_id', userId)
.order('time_ordered', { ascending: false });

if (search) {
query = query.or(line_items.title.ilike.%${search}%);
}

it always gives me an error, how do I write this? Help is very much appreciated
Was this page helpful?