neo4j-graphql / neo4j-graphql-java

Neo4j Labs Project: Pure JVM translation for GraphQL queries and mutations to Neo4j's Cypher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Query by relationship property not match

lozybean opened this issue · comments

In Movie graph database, with graphql schema difinition:

type Movie {
    title: String
    year: Int
    actors: [Person] @relation(name: "ACTED_IN", direction: IN)
}

type Person {
    name: String
}

when query for all the movies which Tom Hanks acted in, using the query like:

query getMoviesActByTomHanks{ 
    movie( filter: { actors: {name:  "Tom Hanks"} }) {
      actors{
          name
      }
      title
      year
   } 
}

and Translator translate the query in to cypher like:

Cypher(query=MATCH (movie:Movie) WHERE  ALL(movie_Person_Cond IN [(movie)<-[:ACTED_IN]-(movie_Person) | (movie_Person.name = $filterMovie_PersonName_EQ)] WHERE movie_Person_Cond)
RETURN movie { actors:[(movie)<-[:ACTED_IN]-(movieActors:Person) | movieActors { .name }], .title, .year } AS movie, params={filterMovie_PersonName_EQ=Tom Hanks}, type=[Movie!]!)

I use this cypher query in neo4j broser, but only get one movie result:

image

that is absolutely wrong, Tom Hanks acted 12 movies in the database:

image

should use actors_some instead of actors

query getMoviesActByTomHanks{ 
               movie( filter: { actors_some: {name:  \"Tom Hanks\"} }) {
                      actors{
                          name
                      }
                      title
                      year
                   } 
                }