Neo4-GraphQL-js:如何对嵌套节点属性进行排序(在嵌套节点属性内排序)

时间:2020-04-24 03:48:08

标签: node.js neo4j graphql grandstack neo4j-graphql-js

graphql-js”:NodeJs App和Neo4j版本中的“ ^ 2.13.0” **为4.x 我想在嵌套的节点属性上使用orderBy。 (请在下面找到用例模式)

GraphQL模式如下

type Product {
   id: String,
   name: String,
   price: String,
   category: String,
   seller: Sellar @relation(name: "SELLING_BY", direction: "OUT")
}
type Sellar {
   id: String,
   name: String,
   location: String
}

以下方法无效,因为orderBy仅可用于顶级节点属性(productName,category等)

GraphQL查询(不起作用)

{
   Product(filter: {
      category_in: "toys" , 
  })
  {
   name,
   price,
   sellar(orderBy: name_desc){
     name,
     location
   }
  }
}

但这会引发以下错误

    {
  "error": {
    "errors": [
      {
        "message": "Unknown argument \"orderBy\" on field \"sellar\" of type \"Product\".",
      //excluded for brevity

如何在嵌套节点属性上实现orderBy ???请帮忙 提前致谢。非常感谢您的帮助.....

0 个答案:

没有答案