With

This page describes how to create a WITH clause using the Cypher®.With class. Note that this is different from the ImportWith statement inside CALL.

A With clause takes multiple parameters. Pass variables directly without aliasing:

const movie = new Cypher.Node();
const withClause = new Cypher.With(movie);
WITH this0

Aliasing

You can pass any expression to With and alias it to a Variable to use it later in the query by passing a tuple of an expression and the aliased variable:

const variable = new Cypher.Variable();
new Cypher.With([new Cypher.Literal("Hello"), variable]);
WITH "Hello" AS var0

Use a string as the alias value if you already know the name:

new Cypher.With([new Cypher.Literal("Hello"), "myVar"]);
WITH "Hello" AS myVar

Wildcard

With accepts the string "*" to add a wildcard to carry over all existing variables. This parameter cannot be aliased, and is always added at the beginning of the WITH statement:

new Cypher.With("*", [movieNode, "result"]);
WITH *, this0 AS result