cssetian
cssetian
Explore posts from servers
DTDrizzle Team
Created by cssetian on 3/8/2024 in #help
Trouble using findMany with joined relation and where clause on relation
it would be great to note this in the docs there, it was confusing to figure out just by looking at the example
8 replies
DTDrizzle Team
Created by cssetian on 3/8/2024 in #help
Trouble using findMany with joined relation and where clause on relation
I see, thanks for the clarification
8 replies
DTDrizzle Team
Created by cssetian on 3/8/2024 in #help
Trouble using findMany with joined relation and where clause on relation
await db.query.posts.findMany({ where: (posts, { eq }) => (eq(posts.id, 1)), with: { comments: { where: (comments, { lt }) => lt(comments.createdAt, new Date()), }, }, });
8 replies
DTDrizzle Team
Created by cssetian on 3/8/2024 in #help
Trouble using findMany with joined relation and where clause on relation
https://orm.drizzle.team/docs/rqb#select-filters - this section of the documentation seems to point out to this being possible though
8 replies
DTDrizzle Team
Created by cssetian on 3/8/2024 in #help
Trouble using findMany with joined relation and where clause on relation
I see, thanks for the response. I will say this feels slightly suboptimal from a query api perspective, that when writing a findMany query you're only limited to a certain subset of where clauses that can be performed on joined tables. You're basically limited from using any kind of joins and filters on joins when writing queries using that funciton, and it seems to be the recommended approach for composing generalized queries, from what i've read at least. Would be great for this query api to support where() clauses nested within 'with' parameters in the findMany function
8 replies