Creating nodes and relationships at the same time in neo4j

前端 未结 4 632
夕颜
夕颜 2021-02-08 06:06

I am trying to build an database in Neo4j with a structure that contains seven different types of nodes, in total around 4-5000 nodes and between them around 40000 relationships

4条回答
  •  清酒与你
    2021-02-08 06:53

    If you have one of the nodes already created then a simple approach would be:

    MATCH (n: user {uid: "1"}) CREATE (n) -[r: posted]-> (p: post {pid: "42", title: "Good Night", msg: "Have a nice and peaceful sleep.", author: n.uid});
    

    Here the user node already exists and you have created a new relation and a new post node.

提交回复
热议问题