Filter on null with GraphQL

This is my query...

{
  allCollection_pages(lang:"en-gb") {
		totalCount
    edges {
      node {
        heading
        child_collections {
          collection {
            ... on Collection_page {
              heading
            }
          }
        }
      }
    }
  }
}

...and this is my response...

{
  "data": {
    "allCollection_pages": {
      "totalCount": 2,
      "edges": [
        {
          "node": {
            "heading": "Fiction",
            "child_collections": null
          }
        },
        {
          "node": {
            "heading": "Arts",
            "child_collections": [
              {
                "collection": {
                  "heading": "Fiction"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

Is it possible to do a query that only returns nodes where child_collections is not null?

1 Like

Hi Jan,

Unfortunately, this is not possible with the GraphQL API, but it is already being tracked as a feature request. The team isn't currently working on this but if/when that changes they will update you here.

Thanks.