How can I check if a node has a label?

19 Views Asked by At

I didn't fid a way how to check if a node has a label. I've found the documentation for HasLabel but this is related to graph output and visualization (https://memgraph.com/docs/data-visualization/graph-style-script/built-in-elements#haslabelnode-label). I need it for my Cypher query.

1

There are 1 best solutions below

0
Aidar Samerkhanov On BEST ANSWER

I think you can use label.exists function.

Query will look like:

MATCH (n) WHERE label.exists(n, "Person") RETURN n;