toInteger

Generic Description

Is the long-form integer conversion alias. It is documented separately because explicit type boundaries prevent planner tools from inventing hidden coercions for document-style values.

Simple example:

RETURN toInteger('42') AS value

Consumer-Level Explanation

Use it when the query style favors fully spelled conversion names. Prefer this function when the input shape is mixed or imported and the query must state the intended type before comparison or aggregation.

More Detailed Explanation

toInteger makes value shape explicit in Cypher. It is most useful around ingestion, document payloads, and assistant-generated queries where the planner should see the intended type boundary rather than relying on hidden client conversion.

Advanced Example

This example applies toInteger at the point where a semi-structured value enters typed query logic, making the conversion boundary explicit.

WITH ['10', '20', '30'] AS raw_scores
UNWIND raw_scores AS raw_score
RETURN raw_score, toInteger(raw_score) AS score_int
ORDER BY score_int DESC

Real Use Cases

Real Limitations And Tradeoffs