EG: If I have a collection, say SportsTeams, with a relation to another collection Matches, is there a reccomended way of setting up so the Matches know which Sports teams they belong to, and the sports teams know which matches they have?
I might be missing something obvious here.
Ended up using a different db setup for that project as there were going to be a lot of two way bindings! Sorry forgot to mark this as closed
... And I'm not sure how to tbh!
Personally I would have a property “teams” in Matches collection that stores array of id (has many) relation to SportsTeams, then turn on indexing for the “teams” field. That way when querying for matches a team has played, you simply use where: {teams: {contains: team_id}}
Hey
@129037731274817537did you try the suggestion
@727901959537033246made here? Let us know if that works for you or if you need additional help here. Thanks!
No worries! I'll take care of it
Star
Discord
online
Get dedicated engineering support directly from the Payload team.