Cypher: Get Remote Relationship Information

MATCH (n:Topic { mongoId: {_id} })-[r]-() DELETE n,r RETURN r;

This returns the error "Error: Relationship 1509 has been deleted."

However, I need to r.mongoIddelete records in another database.

How to do this with Neo4j 2.2.3?

I do this through the Seraph library . Is there a way to collect a property, delete relationships, and return the collection?

I just need this data: MATCH (n:Topic { mongoId: _id })-[r]-() RETURN COLLECT(r.mongoId);

Thanks!

+2
source share
1 answer

You can use the clause WITHto alias the data you want to return before deleting the node and relations. Something like that:

MATCH (n:Topic {mongoId: {_id} })-[r]-() 
WITH r.mongoId as docId, n,r 
DELETE n,r 
RETURN docId

, , node.

: , , , docId:

MATCH (n:Topic {mongoId: {_id} })-[r]->()
...
+5

Source: https://habr.com/ru/post/1621791/


All Articles