I want to add versioning to my documents in my MongoDB. Are there any best practices for versioning in MongoDB? And what's the simplestway to versioning documents in my MongoDB?
Asked
Active
Viewed 8,297 times
12
-
8There are several different approaches to versioning depending on your requirements. For common examples and considerations, see the series of posts on the Ask Asya blog: [How to Track Versions with MongoDB](http://www.askasya.com/post/trackversions/), [Further Thoughts on How to Track Versions with MongoDB](http://www.askasya.com/post/revisitversions/), and [Best Versions with MongoDB](http://www.askasya.com/post/bestversion/). – Stennie Apr 05 '18 at 09:37
1 Answers
2
You could try the approach specified in the document versioning pattern, before you choose this approach make sure that the use case matches the criteria specified i.e. The Document Versioning Pattern makes a few assumptions about the data in the database and the data access patterns that the application makes.
- Each document doesn’t have too many revisions.
- There aren’t too many documents to version.
- Most of the queries performed are done on the most current version of the document.
If you find that these assumptions don’t fit your use case, this pattern may not be a great fit. You may have to alter how you implement your version of the Document Versioning Pattern or your use case may simply require a different solution.

MuthuKumar Haridoss
- 141
- 1
- 4