Graph and Cypher · Engineering

Read-only Cypher: subset, TCK, and limitations

A compatibility subset with a pinned openCypher TCK baseline, explicit unsupported cases, and no write clauses.

Cypher is the query language many teams associate with graph databases. It is expressive, readable, and large. Implementing all of it is a multi-year project, not a feature toggle.

NonoDB exposes a read-only Cypher subset over its document graph. The front end is the MIT-licensed cypher-rs-zk parser/planner; NonoDB supplies the graph adapter, expression evaluation, and storage execution.

The important claim is not “Cypher-compatible”. It is “a documented read-only subset with a pinned TCK baseline and explicit failures”.

API

{"op":"cypher",
"coll":"nodes",
"query":"MATCH (p:Person)-[:KNOWS]->(f) WHERE p.name = $name RETURN f.name AS name ORDER BY name",
"params":{"name":"Alice"},
"max_rows":1000,
"max_operations":1000000,
"timeout_ms":2000,
"max_depth":64}

The response contains columns, rows, row_count, and truncated. Node values expose _id and _labels; relationships expose _id, _type, _start, and _end.

What is supported

  • MATCH, OPTIONAL MATCH, WHERE, RETURN;
  • WITH, UNWIND, ORDER BY, SKIP, LIMIT, DISTINCT with documented partial cases;
  • aggregations count, sum, avg, min, max, collect;
  • expressions including list/map/string/math functions, CASE, comprehensions, map projections;
  • variable-length paths, bounded by max_depth;
  • shortestPath and allShortestPaths (unweighted);
  • some pattern comprehensions and existential subqueries;
  • temporal constructors and accessors with explicit failure for unsupported cases.

Notable partial cases: WITH ... SKIP followed by another MATCH is unsupported; some parser edge cases fail explicitly; CALL {} is not supported.

What is rejected

Write clauses are rejected before planning:

  • CREATE, MERGE, SET, REMOVE, DELETE;
  • LOAD CSV;
  • schema commands;
  • APOC and Bloom;
  • arbitrary procedures.

Only the seven documented GDS-style procedures are available:

gds.pagerank.stream, gds.degree.stream, gds.connectedComponents.stream, gds.nodeSimilarity.stream, gds.labelPropagation.stream, gds.kCore.stream, and gds.degreeDistribution.stream.

That is a deliberate boundary: read-only Cypher cannot mutate the graph, and unsupported syntax returns invalid_query rather than a silent wrong result.

The TCK baseline

The harness pins the openCypher TCK at commit 677cbafabb8c3c5eed458fd3b1ec0daec8d67d23.

Selection covers every result-table scenario with a read-only query, including graph fixtures, named graphs, parameters, MATCH/OPTIONAL MATCH, and pattern/path queries. Expected-error scenarios, write queries, custom test.* procedures, and unsupported fixture syntax are excluded, with each exclusion listed in tck-report.json.

Current baseline: 859 / 874 pass (98.28%), with 0 known wrong-result mismatches and 15 explicit unsupported cases.

That last number matters. A compatibility suite can look good by silently skipping hard cases. Here the unsupported cases are enumerated: nesting above 16 levels, long chained comparisons, parameterised list slices, two temporal functions, two temporal fixture forms, and one WITH ... SKIP/MATCH shape.

Safety limits

Every request is one read-only statement with budgets:

Limit Default
max_rows 1,000 (max 100,000)
max_operations 1,000,000 (max 100,000,000)
max_memory_bytes 64 MiB
timeout_ms 30 s (max 5 min)
max_depth 64
pattern nesting 16 levels

Operation, row, and memory budgets are charged during execution, including UNWIND, DISTINCT, SORT, and UNION. Cancellation returns a structured error.

GDS procedures have separate node/edge/memory/timeout budgets and emit at most max_rows; if the result is larger, truncated is true. Overruns fail explicitly instead of returning an incomplete graph.

When to use it

Use read-only Cypher when:

  • the team already knows Cypher;
  • the query is a read pattern over the configured graph;
  • the supported subset covers the query shape;
  • you want a familiar surface without a second graph database.

Use a full graph database when:

  • writes are part of the graph query;
  • you need APOC, Bloom, or arbitrary procedures;
  • the query needs unsupported Cypher semantics;
  • graph analytics at a much larger scale is the core product.

The Cypher guide contains the compatibility matrix, GDS definitions, TCK report, and exact limits.

All engineering notes →Read the docs