Lamoni
Lamoni

Reputation: 209

Neo4j - Returning nodes in a path along with their IDs

Assuming a query like:

MATCH path=(u:user)-[:CREATED]->(p:post)<-[:REBLOG_OF*]-(p2:post) RETURN path

How can I get the IDs of all nodes in that path along with the path?

Upvotes: 2

Views: 548

Answers (1)

Brian Underwood
Brian Underwood

Reputation: 10856

Does this do what you want?

MATCH path=(u:user)-[:CREATED]->(p:post)<-[:REBLOG_OF*]-(p2:post)
RETURN path, EXTRACT(node IN nodes(path) | ID(node))

Upvotes: 3

Related Questions