Get node by neo4j property value

How can I get node by eigenvalue? I mean something like this: I will try

match (n) where has (n.name = 'Mark') return n

But this is not true.

As well as How to find the node with the maximum property value. I have nodes with the "VIEWS" property, and I want to see the node with the maximum views.

+7
neo4j cypher
source share
1 answer

So close...

 MATCH (n) WHERE n.name = 'Mark' RETURN n 

It is better to include the node shortcut if you have one that will serve to highlight your node from other nodes of different types. Thus, if you have a pointer to a name property and a combination of shortcuts, you will get a better search speed. For example, you can create an index ...

 CREATE INDEX ON :Person(name) 

And then a query labeled Person .

 MATCH (n:Person) WHERE n.name = 'Mark' RETURN n 

Or, alternatively, you can request this method ...

 MATCH (n:Person {name:'Mark'}) RETURN n 

To find the person with the most views ...

 MATCH (n:Person) RETURN n, n.views ORDER BY n.views desc LIMIT 1 

Find most views without a person ...

 MATCH (n:Person) RETURN max(n.views) 
+20
source share

All Articles