0

I'm new to graphql, and trying to understand how I might fill this use case.

I have thousands of nodes of a specific type/schema.
Some of these nodes have children, some of them don't.
I'd like to query all the nodes, and return only the ones that don't have children.

This might get more specific in the future, where I'd like to query only nodes that don't have children of a specific type.

Is that even possible?

I've seen plenty of query examples that show how to select children nodes, or nested nodes + fields, or nodes with specific values. It's an easy thing with SQL, I'm just having trouble understanding how it's done with graphql.

Thoughts?

Jeremy
  • 2,970
  • 1
  • 26
  • 50
  • 1
    FWIW, GraphQL is agnostic to the underlying storage layer and does not provide any built-in functionality around filtering, sorting, etc. These implementation details are left up to the individual server implementation and there is no standard way of doing it. This is really just a question of whether Gentics Mesh exposes this sort of functionality and how it's implemented. – Daniel Rearden Sep 24 '19 at 05:12

1 Answers1

1

As Daniel Rearden said, there is no built in way in GraphQL to filter or sort the results of a query. We have a few filters in our Gentics Mesh GraphQL API, but it is currently not possible to create a filter involving another list of items (children in your case).

I've added your case to the issue in Github. https://github.com/gentics/mesh/issues/27

PGuertler
  • 243
  • 1
  • 2
  • 6