how to query based on relation?
I have many to many relation between Project and User table. How to querry all projects that user is into?
db.query.projects.findMany({
where: ---> users include userId ?
with: {
users: true,
},
});
1 Reply
your where statement could look something like this. Hard to tell without your exact schema.
or you can do a
leftJoin()
and filter at that point: