toInt

Generic Description

Converts integers, floats, booleans, or parseable strings to an integer. It is documented separately because explicit type boundaries prevent planner tools from inventing hidden coercions for document-style values.

Simple example:

RETURN toInt('42') AS value

Consumer-Level Explanation

Use it when an imported payload stores an integer-like value as text and the query needs numeric comparison. 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

toInt 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 toInt 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, toInt(raw_score) AS score_int
ORDER BY score_int DESC

Real Use Cases

Real Limitations And Tradeoffs