Will the following design work:
{
field1 : { latest: "x" , prev : [ "y", "z" ]}
filed2 : { latest : "a" , prev : [ ] }
}
if you know that some fields are immutable you can just keep them as is, otherwise consider the above module.
If that cause the documents grow to very large sizes, I will need to understand the query pattern to suggested a better module.
For example:
- do you need a history of every field in every query?
- Do you require range queries or its just “byId” queries?
- What are the use of history in your applicaiton? Does it make sense to duplicate a document with a newer timestamp for each change.
Ty