Exists
Cypher® EXISTS subqueries can be created with new Cypher.Exists().
To do this, a valid query needs to be passed to Exists.
Note that count subqueries can also be used as predicates in WHERE clauses, for example:
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 *
Simple Exists subqueries
Instead of a Clause, a Pattern can be passed directly to a Exists subquery:
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 *