Hi,
In my database I have the following schema:
(Client)-[r:LINK*0..5]->(Client)
(Sector)
Each Client has a property called 'sector' that is a code referencing the Sector's node's own 'code' property.
E.g.:
Client {
name: "Client #1",
code: "CC1"
sector: "01"
}
Sector {
name: "Retail"
code: "01"
}
I need to query Clients by their code and ideally get the sector's info from within the Clients response.
I'm trying with this query which is only slightly different from what Spring Data Neo4j runs when calling findByCode() :
MATCH (n:`Client`)
WHERE n.code = "CC1"
MATCH (sec:Sector {code:n.sector})
RETURN n{.id, .code, .name, sector:sec, __nodeLabels__: labels(n), __internalNeo4jId__: id(n), __paths__: [p = (n)-[:`LINK`]->()-[:`LINK`*0..]-() | p]}
Expected behavior:
Get all nodes with sector property filled with the Sector data that matches the clients' sector property.
Actual behavior:
Only the first node from the result has sector filled.
I know the query is wrong and I should apply the same MATCH (s:Sector {code:n.sector})) clause to nodes(p) from the path but I don't know how.
Thanks