Search code examples
cyphermemgraphdb

How can I filter nodes by property values and labels in using Cypher query?


I'm trying to use Cypher to perform a graph search that includes node filtering based on property values and label constraints. I want to find all nodes with a name property that starts with "Mc" and is labeled as Manufacturer.

I've tried the following code:

MATCH (n:Manufacturer)
WHERE n.name "Mc*"
RETURN n;

Solution

  • Use the STARTS WITH clause with WHERE condition:

    WHERE n.name STARTS WITH 'Mc'
    

    Everthing else remains the same in your query.