Hello,
I am testing out a POC in neo4j to see if it would fit my use. So far so good. I am trying to build a sales engine that stores the sellers in the form of a binary tree as in the figure:
The each node has a LEFT and RIGHT relationship.
Given a start node, I need to fetch the entire subtree below that node in both LEFT and RIGHT directions up to a certain depth of 15. These returned nodes are for the purpose of being rendered in a webpage, so a nested JSON would be optimal for that.
Currently, I am trying to use a Cypher with APOC approach, as follows:
MATCH path=(d1:Distributor)-[:LEFT|RIGHT*1..3]->(d2)
WHERE d1.name = 'Althaf'
WITH COLLECT(path) AS paths
CALL apoc.convert.toTree(paths) YIELD value RETURN value
However, the query returns the following error:
Failed to invoke procedure apoc.convert.toTree: Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.List (java.lang.String and java.util.List are in module java.base of loader 'bootstrap')