Hi I'm currently using DBMS version 5.1.0
MY data model is (:User)-[:LIKE]->(:Pull)
I'm trying to count the number of likes relationship for a specific Pull using this query
PROFILE
MATCH res=(:Pull {id:"pull4"})-[:LIKE]-()
return size(collect(relationships((res)))) as res
the problem is I'm expanding all the nodes and then accessing the count store I've tried all the below queries:
Query-1:
MATCH (p:Pull {id:"pull4"})
RETURN size( (p)-[:LIKE]-() )
Error:
A pattern expression should only be used in order to test the existence of a pattern. It should therefore only be used in contexts that evaluate to a boolean, e.g. inside the function exists() or in a WHERE-clause. No other uses are allowed, instead they should be replaced by a pattern comprehension. (line 2, column 15 (offset: 43))
"RETURN size( (p)-[:LIKE]-() )"
Query-2:
MATCH (p:Pull {id:"pull4"})
RETURN length( (p)-[:LIKE]-() )
Error:
Type mismatch: expected Path but was List<Path> (line 2, column 17 (offset: 45))
"RETURN length( (p)-[:LIKE]-() )"
Is there a way of counting without the need to expand all like this question https://community.neo4j.com/t5/neo4j-graph-platform/count-store-where-clause-workaround/m-p/18298#M7002 but its answer is my query-1 and it fails