Ooker
Ooker

Reputation: 3012

How to have parameters in property keys in Cypher?

According to Parameters - Neo4j Cypher Manual, this is not allowed

MATCH (n) WHERE n.$param = 'something'

I wonder if there is a way to overcome this?

Upvotes: 2

Views: 286

Answers (1)

Graphileon
Graphileon

Reputation: 5385

It's called 'square bracket syntax' and mentioned here: https://neo4j.com/docs/cypher-manual/current/syntax/operators/#syntax-accessing-dynamic-map-parameter

MATCH (n) WHERE n[$param] = 'something'

Upvotes: 2

Related Questions