Could not find mappable nodes or relationships inside Record

I am trying to find all Relationship of a node - using a Query Like this in neo4j

MATCH (a:User)-[r]-(b) RETURN a, collect(r), collect(b)  limit 10

But I am getting this Error ,could you please help me?:

2021-11-18T11:37:20.0844+0100 [Neo4jDriverIO-2-2] WARN
org.springframework.data.neo4j.core.Neo4jPersistenceExceptionTranslator

  • Don't know how to translate exception of type class org.springframework.data.neo4j.core.mapping.NoRootNodeMappingException

2021-11-18T11:38:41.0486+0100 [Neo4jDriverIO-2-2] ERROR
handler.CommonHandler - SOME ERROR
OCCURRED: Could not find mappable nodes or relationships inside
Record<{r: relationship<1234>, collect(r):
[relationship<12345>], collect(b): [node<6565>]}> for
org.springframework.data.neo4j.core.mapping.DefaultNeo4jPersistentEntity@34cb0e49

I know that
starting with Spring Data Neo4j 6, relationship cannot be top-level entities anymore.
As a consequence, my repository methods return

Mono< User > findARelationship();

thank you as always for your time.

Don't know what you are looking for exactly. I'm fairly new to Neo4j, but what you try seems to be invalid. What if a user has a relation to itself? Then a loop would occur, right?

I was looking at sub-graphs and paths for the course. Maybe this is a good site: How do I collect all of the nodes in a subgraph - #2 by ameyasoft