Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-11-2019 06:58 PM
Let me take simple question. I'm counting the number of nodes and relationships per labels and types. I successfully can count nodes like this query.
CALL db.labels() YIELD label
CALL apoc.cypher.run('MATCH (:`'+label+'`) RETURN count(*) as count',{}) YIELD value
RETURN label, value.count
Along with above query, I compiled query to count relationships per types like this, but it not works. Every value.count shows 0.
CALL db.relationshipTypes() YIELD relationshipType
CALL apoc.cypher.run('MATCH ()-[r:`]'+relationshipType+'`]-() RETURN count(*) as count', {}) YIELD value
RETURN relationshipType, value.count
Please point out my mistake... Thanks to have your time.
Solved! Go to Solution.
03-12-2019 09:02 AM
You have an extra closing square bracket for the relationship in your string, you can remove that:
'MATCH ()-[r:
'+relationshipType+']-() RETURN count(*) as count'
That said, you can get pretty much everything you need via APOC which can dump the count store values:
CALL apoc.meta.stats()
03-12-2019 09:02 AM
You have an extra closing square bracket for the relationship in your string, you can remove that:
'MATCH ()-[r:
'+relationshipType+']-() RETURN count(*) as count'
That said, you can get pretty much everything you need via APOC which can dump the count store values:
CALL apoc.meta.stats()
03-13-2019 10:52 PM
Thanks much for pointing my mistake and useful APOC function !
All the sessions of the conference are now available online