TransWikia.com

GraphQL query not returning result with id argument

Stack Overflow Asked on December 18, 2021

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
      }
    ]
  }
}

However, 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": []
  }
}

I’m relatively new to graphQL and feel like I’m missing something basic, but I’ve searched the documentation and done a lot of Googling around and can’t find the solution. I want to be able to query my graph using memID as an argument and just can’t get it to work.

UPDATE

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:

enter image description here

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP