[英]How do I query nodes that are missing a child of a specific type?
I'm new to graphql, and trying to understand how I might fill this use case.我是 graphql 的新手,并试图了解如何填写此用例。
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.我看过很多查询示例,这些示例展示了如何 select 子节点、嵌套节点 + 字段或具有特定值的节点。 It's an easy thing with SQL, I'm just having trouble understanding how it's done with graphql. SQL 很容易,我只是很难理解 graphql 是如何完成的。
Thoughts?想法?
As Daniel Rearden said, there is no built in way in GraphQL to filter or sort the results of a query.正如 Daniel Rarden 所说,GraphQL 中没有内置方法来过滤或排序查询结果。 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).我们的 Gentics Mesh GraphQL API 中有一些过滤器,但目前无法创建涉及另一个项目列表的过滤器(在您的情况下为儿童)。
I've added your case to the issue in Github.我已将您的案例添加到 Github 中的问题中。 https://github.com/gentics/mesh/issues/27 https://github.com/gentics/mesh/issues/27
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.