Auditing with neo4j: which approach to use?
<p>I need the auditing feature at the application that uses neo4j, something similar to <a href="http://hibernate.org/orm/envers/" rel="nofollow">Hibernate Envers</a>. I haven't found the existing solution for this so I am curious how to implement my own one.</p>

<p>I am planning to use <a href="http://docs.spring.io/spring-data/data-neo4j/docs/2.1.x/reference/html/#d5e1169" rel="nofollow">lifecycle event</a> to generate an old version of node and store it to database (relationship are planned to be persistent at the moment, so need to track node changes only).</p>

<p>I would like to know which approach is better:</p>

<ol>
<li>Generate nodes of the custom type and keep information about changes (ID of the user who made the change, date &amp; time of change, ID of node changed and old state of the changed node) into these nodes. For instance, for user changing his name something like this will be generated:  </li>
</ol>

<p><code>(:Audit:{userID:"001", timeInMillis:"1471507577436", objectID:"4178a373-d6e0-434f-bc45-cf472c106f1a", oldState:"userID:001, firstName:John, secondName:Doe"})</code></p>

<ol start="2">
<li>Keep the old version of the node the same type of node itself, linked to the node itself, adding the revision property with time in milliseconds timestamp there.</li>
</ol>

<p>Th first approach will be probably slow on large datasets, but it is easier to implement. I would like to know which option is best here.  </p>