-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Populated Field aka pseudo Relationship and reverse Relationship #2905
Comments
I'm really struggling to understand this. Do you think you could phrase this in terms of a use-case with a real example of how it should work and what benefit it offers? |
I can try make it simple with Blog demo example. For example I want to add a this will also help in Relationship GraphQL queries where I can use |
It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :) |
Keystone 5 has officially moved into active maintenance mode as we push towards the next major new version Keystone Next, you can find out more information about this transition here. In an effort to sustain the project going forward, we're cleaning up and closing old issues such as this one. If you feel this issue is still relevant for Keystone Next, please let us know. |
Feature request
I see that we have used relationship based on
Id
only. This may not be suitable in all situations probably due to not wanting to populate the database with id everywhere.If you use Relationship field you can have the relationship configured 1 sided or both sided, in 1 sided there is no way to query them in GraphQL, for example you have author field on Post but there is no Relationship on User side where author is. There is no way currently access Post for user as a field on User.
I was thinking about a Populate Field which would work similar to mongoose populate option. We create a field and provide ref to populate the field over graphql.
Advantage:
Describe the solution you'd like
Create a Populate field which would auto fill the data when requested in graphql query
this
post
field is not saved in database but accessible over graphql internally. similar to virtual field it will not be searchable or orderable etc..I think we can not do mongoose like populate which would replace the field with content from source due to dynamic schema being involved with GraphQL but this Populate field may work.
this will be more powerful to gather data based on nested populate fields reducing the backend overhead of multiple queries.
Reverse Relationship was possible in v4 where you could populate field from 1 sided Relationship
in above example actual Relationship was configured in Post list with author field containing id of User.
Describe alternatives you've considered
Relationship field is out of question, you need to do multiple queries in back end process when needing these values.
The text was updated successfully, but these errors were encountered: