Filter on included relations

Hello! Hope you're all doing well! Is it possible to filter based on included relations?
return await this.db.query.myTable.findMany({
with: {
relations: true,
},
where: (doc, { and, eq, inArray }) => {
const predicates: SQL[] = [];
predicates.push(
eq(schema.relationTable.type, "my-type"),
);
predicates.push(
eq(schema.relationTable.value, value.toString()),
);

return predicates.length > 0 ? and(...predicates) : undefined;
},
});
return await this.db.query.myTable.findMany({
with: {
relations: true,
},
where: (doc, { and, eq, inArray }) => {
const predicates: SQL[] = [];
predicates.push(
eq(schema.relationTable.type, "my-type"),
);
predicates.push(
eq(schema.relationTable.value, value.toString()),
);

return predicates.length > 0 ? and(...predicates) : undefined;
},
});
3 Replies
Mario564
Mario5642mo ago
This is currently not possible. We're working on making this a feature in RQB v2
Julian
Julian2mo ago
@Mario564 Just wondering, is there any rough timeline RQBv2? Thanks!
Mario564
Mario5642mo ago
Should be released between this month and the next, exact date TBD

Did you find this page helpful?