I am writing an api to return neo4j data. For my case I get all nodes matching. API takes in userId, limit and offset and return a list of data matching that condition.
I found one solution Cypher to return total node count as well as a limited set but it is pretty old. Not sure if this is still the best way to do it.
Performance is same as firing 2 separate queries, atleast then one of them would be cached by neo4j after couple of runs.
Match(u:WorkstationUser {id: "alw:44807"})-[:HAS_ACCESS_TO]->(p) return distinct(p) skip 0 limit 10
Match(u:WorkstationUser {id: "alw:44807"})-[:HAS_ACCESS_TO]->(p) return count(distinct(p))
I want the result to be something like
{
items: [ {}, {}], # query 1
total: 100, # query 2
limit: 10, # can get from input
skip: 0 # can get from input
}