Exists

Cypher® EXISTS 子查询 可以使用 new Cypher.Exists() 创建。为此,需要将有效查询传递给 Exists

请注意,计数子查询也可以在 WHERE 子句中用作谓词,例如

const subquery = new Cypher.Match(new Cypher.Node({ labels: ["Movie"] })).return("*");

const existsExpr = new Cypher.Exists(subquery);
const match = new Cypher.Match(new Cypher.Node()).where(existsExpr).return("*");
MATCH (this0)
WHERE EXISTS {
    MATCH (this1:Movie)
    RETURN *
}
RETURN *

简单的 Exists 子查询

可以直接向 Exists 子查询传递 Pattern,而不是 Clause

const existsExpr = new Cypher.Exists(new Cypher.Pattern(new Cypher.Node(), { labels: ["Movie"] }))

const match = new Cypher.Match(new Cypher.Node()).where(existsExpr).return("*");
MATCH (this0)
WHERE EXISTS {
    (this1:Movie)
}
RETURN *
© . This site is unofficial and not affiliated with Neo4j, Inc.