Skip to content

Cover NEXT, WHEN, COLLECT and the other 3.0.2 features in depth - #21

Merged
rjb32 merged 1 commit into
mainfrom
docs-3.0.2-coverage
Oct 26, 2026
Merged

rjb32 merged 1 commit into
mainfrom
docs-3.0.2-coverage

Conversation

@rjb32

@rjb32 rjb32 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #20. Its second commit was pushed a moment after #20 was merged, so it never reached main. This PR is that commit, cherry-picked onto main unchanged.

What

New page, NEXT and WHEN (query/composition, in the nav after Results and aggregation). The NEXT and WHEN sections move there from Results and aggregation.

  • NEXT: passing nodes to the next step, longer chains, after a UNION, braced chains as UNION sides, inside CALL / EXISTS / COUNT, writes, and the scoping and alias rules.
  • WHEN ... THEN ... ELSE: several branches, subquery conditions (WHEN EXISTS {...}, WHEN COUNT {...} > 3), per row after NEXT and in CALL, behaviour without ELSE, NEXT chains in a branch, UNION, writes, and rules.

More examples on existing pages

  • COLLECT { }:
    • WHERE, DISTINCT, top-k with ORDER BY / LIMIT, UNION, collected nodes
    • use in WHERE / UNWIND / SET
    • its limits: one column, a full query, no maps, NEXT or WHEN inside
  • Other subqueries: UNION bodies for EXISTS and COUNT, and CALL bodies that write and return what they wrote.
  • FOREACH: edges off a matched node, several clauses per element, list properties (converted with toString), conditional writes with the CASE trick, RETURN after it.
  • Parameters: inside label expressions, in WHERE n:$label, numbered $0, MERGE labels and edge types, and both error messages.
  • Functions and other syntax:
    • examples for the string, normalize, conversion and statistical functions
    • keywords as map keys
    • label expressions in OPTIONAL MATCH and WHERE NOT
    • quantified-path group variables in UNWIND / ORDER BY
    • ASCENDING / DESCENDING

How it was checked

  • Every cypher example in query/ (332 statements) was run against a 3.0.2 server, on the sample graph from the matching page.
    • Every new or changed example passes with the expected rows.
    • The 6 remaining failures need fixtures the test setup lacks (Stations graph, my_index, knows.csv, the greeter extension, two multi-command blocks).
  • The edge cases behind each rule were probed on the same server: what NEXT, WHEN and COLLECT accept and reject, and the exact error messages.
  • npm run build passes (43 pages), and every new internal link resolves.

Gives NEXT and WHEN their own page (query/composition), and extends the
examples for the other new features, each checked on a 3.0.2 server:

- NEXT: passing nodes on, longer chains, after a UNION, braced chains
  as UNION sides, inside CALL / EXISTS / COUNT, writes, scoping rules;
- WHEN: several branches, subquery conditions, per row after NEXT and
  in CALL, no ELSE, NEXT chains in a branch, UNION, writes, rules;
- COLLECT: WHERE, DISTINCT, top-k, UNION, collected nodes, use in
  WHERE / UNWIND / SET, and its limits; UNION bodies for EXISTS/COUNT;
  CALL bodies that write and return;
- FOREACH: edges off a matched node, several clauses, list properties,
  conditional writes, RETURN after it;
- parameters: label expressions, WHERE tests, $0, MERGE, errors;
- functions: string, normalize, conversion and aggregate examples;
  label expressions in OPTIONAL MATCH and WHERE NOT; quantified-path
  group variables; ASCENDING / DESCENDING.
@rjb32
rjb32 merged commit b4ac2ad into main Oct 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant