Filter items by field on relation using query format
Lets say we have table posts that is many to one to a profile:
const posts = await db.query.posts.findMany({
with: {
profile: true,
},
});
I want to be able to get the posts only where the profile relation has subscribed = true, without filtering on the js side
Is there any way to do this with the query (I know I could do select with joins) format, something like:
where: eq(post.profileRelation.subscribed, true)
Thanks for any ideas
0 Replies