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:
- deep filtering doesn’t work, so I can’t filter by a sub-property of the category (see Deep filtering doesn't work · Issue #34 · datocms/gatsby-source-datocms · GitHub)
- 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.