javascriptneo4jgraphqlneo4j-graphql-js

Why using the count function in neo4j with graphql returns two values ​called low and high?


If I execute the following cypher in Neo4j browser returns the expected values

MATCH (n:Document)
RETURN { 
    year: n.year ,
    countdocs : COUNT(n) 
}

Result:

{"countdocs":3,"year":"2018"}    

But If I execute the same cypher in neo4j-graphql

type Query {
    totalActivityOverTime: [JSONObject] @cypher(statement: """
       MATCH (n:Document)
        RETURN { 
         year: n.year ,
         countdocs : COUNT(n) 
       }
    """) 
}

returns :

  {
    "countdocs": {
      "low": 3,
      "high": 0
    },
    "year": "2018"
  },

What means the values ​​low and high?

Thanks!


Solution

  • I think it depends on the type of countdocs. As far as I know, if you define 'countdocs' as BigInt in neo4j-graphql, it returns a dict with {"low": Int, "high": Int} in order to represent 64bit integers. Define countdocs as Int in the schema should resolve the issue. Int type supports up to 53-bit values