Storing relationship field data in the referenced document #5610
skysarwer
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
Bi-directional relationship fields are already confirmed to be on the roadmap per #5073 .
There is a use case where we might only want the data stored in one area, but to have the ux from the perspective of the referenced data
Let's say we have a
tags
collection with a heirarchical structure. Let's say we want to implement a kind of parent / child relationship where documents tagged with parent tags are available from the children tags.A simple example would be having documents tagged with parent
europe
be valid for queries targeting 'spain' or 'france', but documents tagged with childspain
would only be valid for queries targeting 'spain'. This could also be recursive, with 'Madrird', etc.In this use case, it is useful to store the children inside the parent, so in your query you can access
tag.children
. However, from a user perspective, it would be more common to be adding a new smaller bucket tag that is included within but distinct from larger buckets.Bi-directional relationships solve this, but also include redundant data.
For this to work, the field would need to show the relationship data from the relationTo Collection -- perhaps a field name would need to be passed as part of this -- and save the data in that location as well.
Not sure if this optimization would be more of an edge case or generally helpful, but would be curious to hear others thoughts!
Beta Was this translation helpful? Give feedback.
All reactions