Filter
This page describes how to add a FILTER clause with the Cypher®.Filter class.
To add the Filter clause, first create a valid predicate:
const movie = new Cypher.Node();
const predicate = Cypher.eq(movie.property("title"), new Cypher.Param("The Matrix"))
const filterQuery = new Cypher.Filter(predicate);
This generates the following FILTER clause:
FILTER this0.title = "The Matrix"
FILTER clauses can also be created as part of a chain with the .filter method:
const node = new Cypher.Node();
const query = new Cypher.Match(new Cypher.Pattern(node))
.filter(node.hasLabel("Swedish"))
.return([node.property("name"), "name"]);
This generates the following FILTER clause:
MATCH (this0)
FILTER this0:Swedish
RETURN this0.name AS name