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.
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 @rxbbxss did you try the suggestion @paradox5270 made here? Let us know if that works for you or if you need additional help here. Thanks!
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!
No worries! I'll take care of it
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.