Match several node property values in Cypher / Neo4J

cypher, neo4j

Solution

Alternatively, you can do this:

MATCH (c:Context) WHERE c.name IN ['health', 'opinion'] RETURN c

Still not in the "MATCH" statement, but a little easier as your list of possible values grows.

Problem

using Cypher 2 I want to find all the nodes of a certain label (Context), which are called either "health" or "opinion". The query that works is: ``` MATCH (c:Context) WHERE c.name="health" OR c.name="opinion" RETURN c; ``` But I'm wondering if Cypher has a syntax that I could put it into the first MATCH part, something like this: ``` MATCH (c:Context{name:"health"|name:"opinion}) ``` The example above doesn't work, but I'm just showing it to let you know what I mean. Thank you!

Original source