Marking a Query relation as `required`?

I currently have a query like:
const friendTransactions = await db.query.transactions.findMany({
with: {
splits: {
where: (splits, { eq }) => eq(splits.friendId, foundFriend.id),
},
},
});
const friendTransactions = await db.query.transactions.findMany({
with: {
splits: {
where: (splits, { eq }) => eq(splits.friendId, foundFriend.id),
},
},
});
and I want to include splits where the friendId matches a specific value. This works, except I can't figure out the correct way to mark that relation as required (as in, I don't want to have the transaction row returned unless a split row exists that meets the filter condition. This has been a super easy feature in every other ORM I've used, but I can't find anything about it in the Drizzle docs. Anyone know how to accomplish this (preferably without reverting everything to a select() instead)
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server