Versioning MongoDB Documents with Spring Data - Spring Boot
In one of my project I needed to manage all history of the modification that could occurs on my MongoDB document, in order to provide audit-ability. My Technical stack is based on Spring Boot / Spring Data and MongoDB. My post is inpired by : http://www.askasya.com/post/trackversions/ http://www.askasya.com/post/revisitversions/ I choose to handle data integrity by using a single document to store all versions (current + previous) : Solution : The Abstract Document : the root document that will embed alls versions The AbstractEntity : the versionned entity The MongoListener to update audit informations. The user audit aware, in order to propagate user informations Now we can define our own Entity store in a document. For example we define a Project Entity : It will generate this kind of MongoDB document. In Json : Limitations : This solution does not handle the fact that a MongoDocument has a actually a limitation of 16MBytes. The soluti...