Import comments

This commit is contained in:
Robert Schäfer 2019-01-19 00:01:30 +01:00
parent 887a6d201f
commit b272024933
2 changed files with 12 additions and 10 deletions

12
neo4j/import/comments.cql Normal file
View File

@ -0,0 +1,12 @@
CALL apoc.load.json('file:/mongo-export/comments.json') YIELD value as comment
MERGE (c:Comment {id: comment._id["$oid"]})
ON CREATE SET
c.content = comment.content,
c.contentExcerpt = comment.contentExcerpt,
c.deleted = comment.deleted,
c.disabled = false
WITH comment
MATCH (p:Post {id: comment.contributionId}), (u:User {id: comment.userId})
MERGE (c)-[:COMMENTS]->(p)
MERGE (u)-[:WROTE]->(c)
;

View File

@ -15,16 +15,6 @@ ON CREATE SET b.key = badge.key,
CALL apoc.load.json('file:/mongo-export/comments.json') YIELD value as comment
MERGE (c:Comment {id: comment._id["$oid"]})
ON CREATE SET c.content = comment.content,
c.contentExcerpt = comment.contentExcerpt,
c.deleted = comment.deleted
WITH comment
MATCH (p:Post {id: comment.contributionId}),
(u:User {id: comment.userId})
MERGE (c)-[:COMMENTS]->(p)
MERGE (u)-[:WROTE]->(c)
CALL apoc.load.json('file:/mongo-export/follows.json') YIELD value as follow