Filter records by _allReferencingXXX in GraphQL API

This is not something the CDA can currently filter directly at the moment :frowning:

_allReferencingBlogPosts is an inverse relationship field. You can query it on each author, and you can also filter, paginate, and order the nested posts inside that field, as shown here: https://www.datocms.com/docs/content-delivery-api/inverse-relationships. What is not supported is using that inverse relationship itself inside the root allAuthors(filter: ...) input, so allAuthors(filter: { _allReferencingBlogPosts: { exists: true } }) will not work.

If you compare the filtering docs at https://www.datocms.com/docs/content-delivery-api/filtering-records with the inverse relationship docs above, the distinction is that inverse relationships are exposed as query fields with their own nested arguments, not as top level collection filters. We also described the same limitation in a related thread here: https://community.datocms.com/t/filter-records-to-only-those-linking-to-a-specific-type/4631

The practical workaround is either to query allBlogPosts and traverse to author, deduping authors in your application, or to query allAuthors and inspect _allReferencingBlogPostsMeta { count }, then keep only authors where the count is greater than zero. For example:

query {
  allAuthors {
    id
    firstName
    lastName
    _allReferencingBlogPostsMeta {
      count
    }
    _allReferencingBlogPosts {
      title
    }
  }
}

So in practice, _allReferencingXXX can be queried, and its nested results can be filtered, but it cannot currently be used to filter the parent collection by existence