mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Fix comments import
@appinteractive
This commit is contained in:
parent
0705ab1bf5
commit
9656bd4eb7
@ -1,12 +1,14 @@
|
||||
CALL apoc.load.json('file:/mongo-export/comments.json') YIELD value as comment
|
||||
MERGE (c:Comment {id: comment._id["$oid"]})
|
||||
CALL apoc.load.json('file:/mongo-export/comments.json') YIELD value as json
|
||||
MERGE (comment:Comment {id: json._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)
|
||||
comment.content = json.content,
|
||||
comment.contentExcerpt = json.contentExcerpt,
|
||||
comment.deleted = json.deleted,
|
||||
comment.disabled = false
|
||||
WITH comment, json, json.contributionId as postId
|
||||
MATCH (post:Post {id: postId})
|
||||
WITH comment, post, json.userId as userId
|
||||
MATCH (author:User {id: userId})
|
||||
MERGE (comment)-[:COMMENTS]->(post)
|
||||
MERGE (author)-[:WROTE]->(comment)
|
||||
;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user