If I have a Post model with a category property of type PostCategory, it allows me to easily display the post’s category when querying for a specific post: datoCmsPost(...) { category { ... } } (this is the syntax of gatsby-source-datocms).
To do the opposite and create a page with all posts of a specific category, currently I have to query all posts and add a filter to select only the relevant category: allDatoCmsPost(filter: { category: { ... } }) { ... }.
from a semantic point of view it would be more logical to just query datoCmsCategory(...) { posts { ... } }.
So it would be great if, when creating the Post’s category property in the dashboard, we could expose the inverse relation as well. (Kind of equivalent to belongs_to :parent_model, inverse_of: :model in ruby on rails.) This inverse relation would be visible/navigatable in DatoCMS’ dashboard and in the GraphQL API and gatsby-source-datocms API.
We are currently looking into GraphQL headless CMSs and deep filtering is the major missing piece for us in DatoCMS. GraphCMS and others have this ability but we much prefer DatoCMS interface and flexibility. Are there any plans to make this happen?
We don’t have an ETA for this yet, we are working on some important changes at the core of our application and then we’ll be working on these features.
Hi @mat_jack1 , now that you’ve released some major database performance improvements in March, is deep filtering / inverse relations something you’re actively working on?
So far we’ve been able to cope without, but for some new sections on the platform we’re building this feature would really come in handy.
No sorry. It’s surely one of the big features that we are going to tackle first. But now we are working on some more small stuff that is more urgent for us. We’ll let you know when we start development of this.
Alright, we just shipped GraphQL inverse relationships in public beta!
This means that the feature is fully usable on all projects and plans, but following your feedback, things may change in future versions without notifications.
You can read all the details in the following doc page:
And please let us know what you think about it, so we can move this feature to the next phase! Thanks!
I agree this looks great and makes a number of relationships I was working on work much easier.
Its difficult to go too deeply into this with the note that we shouldn’t use this in production. Do you have any further info on when it might be deemed stable?
I have a project I’m working on now that would really benefit from this.