Company
Date Published
Author
Daniel Coupal, Ken W. Alger
Word count
1023
Language
English
Hacker News points
None

Summary

The Document Versioning Pattern is a design pattern used to keep the version history of documents available and usable in MongoDB databases. This pattern addresses the problem of wanting to keep around older revisions of some documents instead of bringing in a second management system by adding a field to each document to track the document version, resulting in two collections: one for the latest data and another for all the revisions. The pattern is useful in highly regulated industries that require a specific point in time version of a set of data, such as financial and healthcare industries, and can be used in scenarios where there are few revisions and most queries are done on the current version of the document. The pattern is relatively easy to implement and can be applied to an existing set of documents, but it may not be suitable for use cases with frequent changes or high write volumes to the database.