Cypher expressions
This page contains examples of allowed expressions in Cypher®.
General
-
A variable:
n
,x
,rel
,myFancyVariable
,`A name with special characters in it[]!`
. -
A property:
n.prop
,x.prop
,rel.thisProperty
,myFancyVariable.`(special property name)`
. -
A dynamic property:
n["prop"]
,rel[n.city + n.zip]
,map[coll[0]]
. -
A parameter:
$param
,$0
. -
A list of expressions:
['a', 'b']
,[1, 2, 3]
,['a', 2, n.property, $param]
,[]
. -
A function call:
length(p)
,nodes(p)
. -
An aggregate function call:
avg(x.prop)
,count(*)
. -
A path-pattern:
(a)-[r]->(b)
,(a)-[r]-(b)
,(a)--(b)
,(a)-->()<--(b)
. -
An operator application:
1 + 2
,3 < 4
. -
A subquery expression:
COUNT {}
,COLLECT {}
,EXISTS {}
,CALL {}
. -
A regular expression:
a.name =~ 'Tim.*'
. -
A
CASE
expression. -
null
.
Expressions containing unsanitized user input may make your application vulnerable to Cypher injection. Consider using parameters instead. Learn more in Protecting against Cypher Injection. |
Most expressions in Cypher evaluate to |
Numerical
-
A numeric (
INTEGER
orFLOAT
) literal:13
,-40000
,3.14
. -
A numeric (
INTEGER
orFLOAT
) literal in scientific notation:6.022E23
. -
A hexadecimal
INTEGER
literal (starting with0x
):0x13af
,0xFC3A9
,-0x66eff
. -
An octal
INTEGER
literal (starting with0o
):0o1372
,-0o5671
. -
A
FLOAT
literal:Inf
,Infinity
,NaN
. -
null
.
Any numeric literal may contain an underscore |