I'm working with Payload CMS and have a scenario where I need to establish bi-directional relationships between two collections, similar to a classic articles-tags relationship. One article can have many tags, and one tag can be associated with many articles. When a user clicks on a tag, they should be directed to a tag page listing all associated articles, and vice versa.
I've attempted to implement this by adding a relationship field to both collections to reference each other, but I'm facing challenges in maintaining the relationship in both directions. Specifically, when I add tags to an article, the reverse (articles being associated with a tag) isn't automatically updated.
I'm looking for advice on how to effectively manage bi-directional relationships in Payload CMS, including any workarounds or third-party solutions that could help achieve this functionality. Any guidance or examples would be greatly appreciated.
My expectation is to find a more robust solution or best practices for managing bi-directional relationships in Payload CMS. Ideally, I'm looking for guidance on how to correctly implement and use hooks or plugins to ensure data integrity and performance