Evanston
DTDrizzle Team
•Created by Evanston on 1/4/2025 in #help
Filtering Entire Objects by Related Records in Drizzle ORM Query API
Hi,
Is there currently functionality with Drizzle's query API to filter entire objects based on the contents of their relationships, rather than just filtering the related objects themselves. Specifically, I want to filter the main object (sourceTable) based on a condition in its related object (userToSource).
Here is an example of what I'm currently doing:
In this example, I want the entire sourceTable object to be returned only if the userToSource relationship meets the specified condition (userToSource.userId === user.id). However, it seems that the current functionality only filters the userToSource relationship itself, not the main sourceTable object.
Thank in advance!
10 replies