对于给定的多个节点找到一个节点
For the given multiple nodes find a node
在不读取所有给定的用户节点的情况下,有没有办法使用给定的考试节点找到它?
示例:
对于给定的考试节点 mtech
和 mca
,我如何找到用户节点?
已编辑:
对于给定的两个考试节点,您可以通过执行 1) 与用户节点的无向匹配 2) 收集考试名称 3) 然后检查名称 mtech 和 mca 是否都在合集
MATCH (u :User) - [ :enrolled] - (e :Exam)
WHERE e.name in [ 'mtech', 'mca' ] // assuming that an index is created for Exam.name
WITH collect(distinct e.name) as exams, u
WHERE ALL(ex in [ 'mtech', 'mca' ] where ex in exams )
RETURN u
在不读取所有给定的用户节点的情况下,有没有办法使用给定的考试节点找到它?
示例:
对于给定的考试节点 mtech
和 mca
,我如何找到用户节点?
已编辑: 对于给定的两个考试节点,您可以通过执行 1) 与用户节点的无向匹配 2) 收集考试名称 3) 然后检查名称 mtech 和 mca 是否都在合集
MATCH (u :User) - [ :enrolled] - (e :Exam)
WHERE e.name in [ 'mtech', 'mca' ] // assuming that an index is created for Exam.name
WITH collect(distinct e.name) as exams, u
WHERE ALL(ex in [ 'mtech', 'mca' ] where ex in exams )
RETURN u