Neo4j, get all relationships between a set of nodes

后端 未结 6 1097
遥遥无期
遥遥无期 2021-01-05 00:13

I\'ve a query that fetches nodes based on a property

MATCH (c { type: \'sometype\' })
WITH c LIMIT 100
RETURN c

all I want is to also fetch

6条回答
  •  逝去的感伤
    2021-01-05 00:55

    alex,

    Another way to approach this is this query:

    MATCH (c {type : 'sometype'})-[r:*0..1]-(d {type : 'sometype'})
    WITH c, collect(r) as rs
    RETURN c, rs
    

    This allows for the case where there are no relationships of this sort.

    Grace and peace,

    Jim

提交回复
热议问题