0

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!

nguaman
  • 925
  • 1
  • 9
  • 23
  • 1
    Does this answer your question? [Convert neo4j Integer object to JavaScript integer](https://stackoverflow.com/questions/38038019/convert-neo4j-integer-object-to-javascript-integer) – stdob-- Feb 05 '22 at 02:32

2 Answers2

1

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

Sbunzini
  • 542
  • 2
  • 8
0

Thanks to @Sbunzini and @stdob-- I found the solution:

Schema:

type Activity{
  year: String
  countdocs: Int
}

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

GraphQL:

{
  totalActivityOverTime{
    year
    countdocs 
  }
}

Thanks!

nguaman
  • 925
  • 1
  • 9
  • 23