SpicedS
Convex Community3y ago
2 replies
Spiced

relationships / joins

For example and more clarification this is my query:

export const getDiagrams = query({
args: {},
handler: async (ctx) => {
const identity = await ctx.auth.getUserIdentity();

if (!identity) {
throw new Error("Unauthorized");
}
const userId = identity.subject;

const dashboard = await ctx.db
.query("diagrams")
.withIndex("by_user", (q) => q.eq("userId", userId))
.filter((q) => q.eq(q.field("isArchived"), false))
.collect();

return dashboard;
},
});

i have a relationship in the entities, linked to the diagramId. Is there any way to retreive them all at once ?
Was this page helpful?