Search code examples
azureazure-storageazure-cosmosdb

Data tracking in DocumentDB


I was trying to keep the history of data (at least one step back) of DocumentDB.

For example, if I have a property called Name in document with value "Pieter". Now I am changing that to "Sam", I have to maintain the history , it was "Pieter" previously.

As of now I am thinking of a pre-trigger. Any other solutions ?


Solution

  • If you're trying to make an audit log I'd suggest looking into Event Sourcing.Building your domain from events ensures a correct log. See https://msdn.microsoft.com/en-us/library/dn589792.aspx and http://www.martinfowler.com/eaaDev/EventSourcing.html