Enhancement Request: Support for Bi-Directional Relationships #8508
raccoon70
started this conversation in
Feature Requests & Ideas
Replies: 1 comment
-
It sounds like you're looking for the new Join field in V3.0 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description:
Payload CMS currently supports one-way relationships (e.g., belongsTo, hasMany). However, bi-directional relationships are often needed to ensure that related data stays synchronized in both directions (e.g., a Post with an Author, where changes to either are reflected in both models).
Motivation:
Bi-directional relationships will:
• Ensure data integrity between related models.
• Simplify querying and reduce manual relationship syncing.
• Improve the user experience when managing related data.
Proposed Solution:
• Add a bidirectional flag to relationship fields, or
• Provide built-in relationship types like belongsToMany and manyToMany to handle bi-directional syncing automatically.
Example Use Case:
A Project has multiple Collaborators, and Collaborators belong to multiple Projects. Changes in one model should update the other automatically.
Beta Was this translation helpful? Give feedback.
All reactions