Apoc / graphql query do not return as expected

graphql

(Adamclark64) #1

A query that works just fine in the neo4j desktop browser does not return the expected results when ran through graphql and apoc procedures.

Here is my schema in graphql

    byParent(id: Int): [movie]
        @cypher(
            statement: "MATCH (movie:movie)-->(c:movie) WHERE ID(movie)=$id RETURN c"
        )

Here is the graphql query

query {
  byParent(id: 108) {
    _id
  }
}

Here is the generated apoc output in my console

WITH apoc.cypher.runFirstColumn("MATCH (movie:movie)-->(c:movie) WHERE ID(movie)=$id RETURN c", {id:$id}, True) AS x UNWIND x AS movie
    RETURN movie {_id: ID(movie)} AS movie SKIP $offset
{ offset: 0, first: -1, id: 108 }

When ran through graphql I always get an empty array but the same query in the browser gives my the expected results (just swapping out the dynamic {id:$id} for {id:108} and changing WITH to RETURN)

RETURN apoc.cypher.runFirstColumn("MATCH (movie:movie)-->(c:movie) WHERE ID(movie)=$id RETURN c", {id:108}, True)

I am not sure if the error is with apoc, graphql or the way i am defining schema / writing the query but the fact I can run the generated query with some minor modification in the browser confuses me. I would love some clarification on this


(Michael Hunger) #2

Can you please update your version of neo4j-graphql-js, the APOC function to call has changed (due to a change in Neo4j 3.4)

And let us know if that helped.


(Adamclark64) #4

I am now using neo4j-graphql-js@2.1.0 but generated APOC query is the same and still no results back.

WITH apoc.cypher.runFirstColumn("MATCH (movie:movie)-->(c:movie) WHERE ID(movie)=$id RETURN c", {id:$id}, True) AS x UNWIND x AS `movie`
    RETURN `movie` {_id: ID(`movie`)} AS `movie` SKIP $offset
{ offset: 0, first: -1, id: 108 }

server and browser version are of a version. Idk if this matters

Neo4j Browser version: 3.2.15

Neo4j Server version: 3.4.6 (enterprise)

(Michael Hunger) #5

Really odd, you're right.


(Adamclark64) #6

I opened this up and I can see that it is coming through the customQuery() in neo4j-graphql-js/dist/translate.js where the query is formed. I am not very familiar enough with Neo4j to know how to handle this in a scalable manner but would love to get this figured out and help if I can.