Structuring change history data in MongoDB / NoSQL
1
vote
1
answer
5685
views
I have a Chart on which I need to track changes; the Chart has several properties. A Chart also has a long list of items.
So in C#, my Chart object looks like this:
public class Chart {
public int Id { get; set; }
public string Title { get; set; }
...
public List Items { get; set; }
}
Or in JSON, my Chart looks like this (I wrote this JSON by hand, so it could be wrong):
{
"Id": 1,
"Title": "Test Chart",
"Items": [
{
"Id": 222,
"Title": "Test Item",
"Price": 112.34
}
]
}
So my question is as follows:
Should I log an entire chart with all the items as a single document, every time there is a change? (Although I read there may be a limit on document size, so this could be a problem.)
OR
Should I log Chart changes as one type of document and Chart Item changes as a separate type of document? This would allow me to store changes to chart items as a single "line item" document without having to save the entire Chart every time there is a change to a single chart item.
OR
Is there a better way?
Asked by Targaryen
(113 rep)
Mar 13, 2018, 06:29 PM
Last activity: Apr 8, 2018, 11:22 AM
Last activity: Apr 8, 2018, 11:22 AM