neo4j

Get all nodes cypher query neo4j

The Cypher Query to fetch all nodes of a neo4j graph database.

MATCH (n)
RETURN n

In the neo4j graph database, we use Cypher queries to add and get data. To retrieve all nodes or data points in the neo4j graph database we can use the above Cypher query which will show you all nodes in the graph database.

We have created a sample database and when we run this query in the neo4j environment it will return you all nodes which will look like the below image.

Here, we have created two nodes Movie and Person where the person is related to one or multiple movies. The relationship can be easily created in the neo4j graph database.

MATCH (n) 
RETURN n 
LIMIT 10
To get n number of nodes using Cypher query in neo4j graph database. The above query can be used. We are getting 10 nodes using the above query.
Was this helpful?