neo4j-graphql / neo4j-graphql-js

NOTE: This project is no longer actively maintained. Please consider using the official Neo4j GraphQL Library (linked in README).
Other
609 stars 147 forks source link

GraphQL query not returning result with id argument #504

Open seanbetts opened 4 years ago

seanbetts commented 4 years ago

This issue pertains to the following package(s):

GraphQL Playground

What OS and OS version are you experiencing the issue(s) on?

MacOS 10.15.6

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

neo4j-graphql-js 2.14.4

What is the expected behavior?

I have a basic graph set up on Neo4j that contains some movies and I'm using GraphQL to connect to it from a React App. I am testing some queries using the GraphQL playground before adding them to my React App and I've run into an issue when passing an ID type argument. Each of my mem nodes has the following schema (as displayed in the GraphQL playground documents):

Mem(
memID: ID
mem: String
date: _Neo4jDateInput
memType: String
emoji: String
pictures: String
personID: Int
placeID: Int
favourite: Boolean
public: Boolean
_id: String
first: Int
offset: Int
orderBy: [_MemOrdering]
filter: _MemFilter
): [Mem]
When I query the graph, I can pass arguments, such as the mem string to return a particular node. For example, the following query:

{
  Mem(mem: "The Empire Strikes Back") {
        memID
        mem
        favourite
  }
}
Returns the following data from that node:

{
  "data": {
    "Mem": [
      {
        "memID": "180",
        "mem": "The Empire Strikes Back",
        "favourite": false
      }
    ]
  }
}

What is the actual behavior?

When I try to pass a memID as an argument, as follows:

{
  Mem(memID: 180) {
        memID
        mem
        favourite
  }
}
I get the following response instead of it returning the node's data:

{
  "data": {
    "Mem": []
  }
}

What steps may we take to reproduce the behavior?

Query a graph database using an ID as an argument

Please provide a gif or image of the issue for a quicker response/fix. The documentation states that memID is a scalar and I just can't figure out how to express it in the query. It states it can be expresses as a number or a string but neither have worked

I have also posted about this on stackoverflow here

robinelvin commented 3 years ago

I don't know if you've solved this but memID is not a scalar value. It is in fact a string so I think your query should be

{
  Mem(memID: "180") {
        memID
        mem
        favourite
  }
}
michaeldgraham commented 3 years ago

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608