Expose inverse relations in Dashboard and GraphQL API

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: { ... } }) { ... }.

However:

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?

“is the major missing piece” -Absolutly!

are there some updates for this issue?

Any updates on deep filtering?

1 Like

Is there any update on this, it is a sorely lacking functionality when we are trying to use parent child relationship instead of locales.

no updates yet, but I see your point and I agree. We’ll surely look into this in the future though

Is there a timeline for this? Having inverse access as described here would massively simplify some of our query logic.

2 Likes

We’re also facing this issue right now. Anyone having a temp solution for this?

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.

For now, with the REST API there’s this call to get referenced records: Referenced records - Record - Content Management API

With GraphQL instead it should be done on your end unfortunately, so you need to get the data for the two models and build the backlinks in your code.

1 Like

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. :slight_smile:

hello @thomas.degroof I think so, yes. I cannot confirm right now, but it’s probably something on which we are going to work in the near future!

1 Like

Any updates on the timeline of this feature @mat_jack1 ?
We would love this feature as well!

@mat_jack1 any update on the timeline of this feature?

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.

1 Like

@mat_jack1 Any update on this? This feature would really bring a lot of value to your product.

no news for now, but it’s surely on our radar :slight_smile:

Alright, we just shipped GraphQL inverse relationships in public beta! :partying_face::partying_face::partying_face:

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!

5 Likes

This looks awesome! Does the team plan on introducing any breaking changes and maintaining this regardless of adoption?

This would be really useful for my project but I’m reluctant to start using it given that it’s still in beta!

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.

thanks!