How do I implement revisions with neo4j?

后端 未结 2 866
甜味超标
甜味超标 2021-02-04 11:53

I have an object and I need to keep a history of all changes made to it. How would I implement this using neo4j?

2条回答
  •  半阙折子戏
    2021-02-04 12:09

    You could also approach it from the other side:

    (pages)-[:VERSION]->(V1)-[:VERSION]->(V2)-[:VERSION]->(V3)
       ^                                                   ^
       |                                                   |
    category                                            current
      node                                          version of page
    

    advantage : when you create a new version, you just add it at the end of the chain, no need to "insert" it between the (page) and the current version.

    disadvantage :you can't just throw away old versions, unless you reconstruct the chain. But this is probably not a frequent operation.

提交回复
热议问题