简体   繁体   English

如何查询缺少特定类型子节点的节点?

[英]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.

相关问题 当参数为输入类型时,如何查询GraphQL模式? - How do I query GraphQL schema when the argument is an input type? 我想如何在neo4j graphql js中使用自定义查询返回关系类型 - How do I suppose to do to return a relation type with custom query in neo4j graphql js 打字稿:我该如何引用匿名类型,它是命名类型的子级? - Typescript: How can I refer to an anonymous type that is a child of a named type? Apollo GraphQL 解析器如何将参数传递给查询子类型 - Apollo GraphQL resolvers how to pass arguments to query child type 根据我分配给根节点的类型,从根查询接收类型检查错误。 GraphQL,TypeScript。 表达 - Receiving type-checking error from root query based on the type I assign to my root nodes. GraphQL, TypeScript. Express 如何以RANGE_ADD突变更新连接的节点? - How do I update connected Nodes in a RANGE_ADD mutation? Gatsby:如何列出所有节点? - Gatsby: How Do I Make a List of All Nodes? Graphene/Django (GraphQL):如何使用查询参数来排除匹配特定过滤器的节点? - Graphene/Django (GraphQL): How to use a query argument in order to exclude nodes matching a specific filter? 如何在包含graphql / prisma中的关系的类型上创建查询? - How do I create a query on a type which includes a relation in graphql/prisma? 如何通过 GraphQL 中的缺失关系进行查询? - How to query by missing relationship in GraphQL?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM