结合Cypher和GraphQL无法遍历关系节点

时间:2019-12-12 03:04:03

标签: node.js neo4j graphql cypher grandstack

我是Neo4j的新手,并且过去几天一直在学习如何通过Grandstack将GraphQL与Neo4j一起使用。我一直在研究this Guidethis Repository的设置方案。我一直在研究示例neo4j movie database,我正在尝试进行基本查询,在该查询中,我使用密码查询通过评分来选择电影,如下所示。在浏览器中进行测试时,如何收到以下错误。知道如何解决此问题或我做错了什么,谢谢

   const typeDefs = `
type Movie {
    title: String
    tagLine: String
    released: Int 
    reviews: [Reviewed] 
}
type Reviewed @relation(name: "REVIEWED"){
    from: Person
    to: Movie
    summary: String
    rating: String
}
type Person {
    name: String
    born: Int
    actedIn: [Movie] @relation(name: "ACTED_IN",direction:"OUT")
}

type Query {
    Movie(title: String ,released: Int, first: Int, offset: Int): [Movie]
    ReviewsByScore(score: Int): [Reviewed] @cypher(statement: "MATCH()-[r:REVIEWED]-() WHERE r.rating >= $score RETURN r;")
}
`;

const schema = neo4jgraphql.makeAugmentedSchema({ typeDefs });

在浏览器中,我运行以下查询

{
  ReviewsByScore(score: 100) {
    rating
    summary
    to{
      title
    }
  }
}

,并收到以下错误。

  

{“错误”:[       {         “ message”:“无法读取未定义的属性”值“,         “位置”:[           {             “行”:2             “栏”:3           }         ],         “路径”:[           “ ReviewsByScore”         ],         “扩展名”:{           “ code”:“ INTERNAL_SERVER_ERROR”,           “例外”:{             “堆栈跟踪”: [               “ TypeError:无法读取未定义的属性'value'”,               “位于getRelationTypeDirective(/ Users / a123456 / Desktop / Neo4j测试   Javascript / node_modules / neo4j-graphql-js / dist / utils.js:763:7)“,               在buildCypherSelection(/ Users / a123456 / Desktop / Neo4j测试   Javascript / node_modules / neo4j-graphql-js / dist / selections.js:184:64)“,               “递归(/ Users / a123456 / Desktop / Neo4j Test Javascript / node_modules / neo4j-graphql-js / dist / selections.js:87:33)”,               在buildCypherSelection(/ Users / a123456 / Desktop / Neo4j测试   Javascript / node_modules / neo4j-graphql-js / dist / selections.js:176:12)“,               “递归(/ Users / a123456 / Desktop / Neo4j Test Javascript / node_modules / neo4j-graphql-js / dist / selections.js:87:33)”,               在buildCypherSelection(/ Users / a123456 / Desktop / Neo4j测试   Javascript / node_modules / neo4j-graphql-js / dist / selections.js:176:12)“,               “在customQuery(/ Users / a123456 / Desktop / Neo4j Test Javascript / node_modules / neo4j-graphql-js / dist / translate.js:575:68)上”,               “在translateQuery(/ Users / a123456 / Desktop / Neo4j Test Javascript / node_modules / neo4j-graphql-js / dist / translate.js:518:12)上,”,               “在cypherQuery(/ Users / a123456 / Desktop / Neo4j Test Javascript / node_modules / neo4j-graphql-js / dist / index.js:146:40)”,               “位于_callee $(/ Users / a123456 / Desktop / Neo4j Test Javascript / node_modules / neo4j-graphql-js / dist / index.js:73:31)”             ]           }         }       }],“数据”:{       “ ReviewsByScore”:null}}

0 个答案:

没有答案