#Optional one to many relationship (convex-ents)
8 messages · Page 1 of 1 (latest)
Not at the moment, but you're not the first to ask! Tracking issue: https://github.com/xixixao/convex-ents/issues/5
You can model this atm without Ents (via an ID field) or as a many:many edge.
@elfin walrus ok, if I model it without ents, i presume that I won't be able to use the edge methods on this relationship too right ?
you answered so fast thank you
I'd probably go with many:many, it will give you the flexibility to later change your design to allow users to be attached to multiple groups.
Ok thanks for the advice
Hello @elfin walrus any idea on how to replace search since I can't use withSearchIndex with ctx.table ? I mean in convex way. For now I will implement it myself
It's so funny i was just researching this stuff just now. The saas-starter has a .searchIndex. Its being used on members.ts like this.
const query =
search === ""
? ctx.table("teams").getX(teamId).edge("members")
: ctx
.table("members")
.search("searchable", (q) =>
q
.search("searchable", normalizeStringForSearch(search))
.eq("teamId", teamId)
);
I'm trying to use the complex index and search filtering in the fullstack convex template as guidance and with similar complexity so I'm struggling through trying to do it in ents.