mattposgate
mattposgate
DTDrizzle Team
Created by mattposgate on 1/21/2024 in #help
Simple but tricky
Hi all, I'm struggling with this simple use case: contacts have contact_email_addresses (joined on contact.id = contact_email_address.contact_id) when running: const rows = await db.query.contact.findMany({ with: { emailAddresses: true }, }); I get a nicely formed array of contact objects that each also contain an array of contact_email_addresses. Nice! (I can see behind the scenes drizzle is using json_arrayagg and json_array) I now need to get the same result structure but only include contacts where contact_email_address.email like '%something%' Any help much appreciated
7 replies