Search code examples
javascriptnode.jsneo4jcypherneo4jclient

Getting all connected nodes in neo4j, using neo4j-driver


I have been developing a javascript wrapper library over neo4j-driver. Though I was facing a little difficulty to obtain all the nodes using the api.

The query does work in neo4j browser, but returns only a single node using neo4j-driver.

MATCH (n) MATCH (n)-[r]-(p) RETURN p

For instance: Using broweser

Whereas using neo4j-driver: enter image description here

My question: Is there another way(another query) that could return me all the connected nodes?


Solution

  • You have an issue with the response you get from neo4j-driver library as the Cypher Query returns all nodes, as per the relation, i.e, MATCH (n) MATCH (n)-[r]-(p) RETURN p, returns all nodes connected to (n).

    Check the way you are parsing the result from the neo4j-driver.