Middle+
In what case would you suggest storing the state of an object not as a document attribute, but as a separate change history?
sobes.tech AI
Answer from AI
Storing the state of an object in a separate change history (audit trail, event sourcing) is advisable when:
- You need to track all changes for auditing or restoring the state at any point in time.
- The ability to roll back to previous versions of the object is important.
- The system must support complex business process logic with a history of changes.
- It is necessary to analyze data evolution for reporting or decision-making.
For example, in financial applications or order management systems, where it is important to see who and when changed data, and to have the ability to restore the state at a specific moment.