I've created a query in neo4j :
MATCH (x:Node)-[r*1..2]->(y:Node)
WITH x AS x, SIZE(COLLECT(DISTINCT y)) AS y
WITH CASE
WHEN y=10 THEN x.target
END AS l
return l AS target
But returns something like :
target
____
null
null
"test1"
null
null
"tes56...