假设您有一个满足以下方案的数据库:
(person {name:string, budget:int})
(person)-[:FRIEND]-(person)
如何在 Cypher 中查询以下内容?
“给 Alice 的所有朋友,其中所有朋友的预算都大于 100。”
您可以在 Cypher 中使用以下查询来实现此目的:
MATCH (alice {name:"Alice"})
MATCH (alice)-[:FRIEND]-(f)
MATCH (f)-[:FRIEND]-(person)
WITH f, collect(person) as friends
WHERE ALL(x in friends WHERE x.budget > 100 )
RETURN f, friends