I'm thinking about this in terms of a No SQL database, more specifically MongoDB. So, I want to build something like Google Analytics where I will be taking in a ton of data and when it occurs so I can show how many times X happened this year/month/week/day/hr/etc. Like Google Analytics, other than the time stamp, the only other data being stored is small data. There will also be multiple points from which I'm taking in data, like how there's different admins in Google Analytics with their own dashboard. I'll give an example.
There's 3 "admins" with their own dashboard and website, then we need to take in data from each site. For simplicity sake the only data we'll be taking in is when a user leaves a comment on their page and if the comment had a picture.
This is how I originally had it, but of course there's no time stamp
{
Name: "Admin 1",
numComments: 10,
hadPics: {Yes: 6, No: 4}
},{
Name: "Admin 2",
numComments: 12,
hadPics: {Yes: 6, No: 6}
},{
Name: "Admin 3",
numComments: 5,
hadPics: {Yes: 3, No: 2}
}
Then I changed it to this
{
Name: "Admin 1",
numComments: 3,
time: [{
time: "3/28/2020 - 6:45:36 am",
hadPics: "No"
},{
time: "3/28/2020 - 6:45:37 am",
hadPics: "Yes"
},{
time: "3/28/2020 - 6:46:10 am",
hadPics: "Yes"
}]
},{
Name: "Admin 2",
numComments: 5,
time: [{same structure as above}]
},{
Name: "Admin 3",
numComments: 6,
time: [{same structure as above}]
}
But I imagine this would get insanely huge and is not a good way to store the data, not to mention I also just found out that collections have a max space of 16mb which sounds like something I would pass if I were to store it like that? Like the time
array would get very big. This is only from 3 comments, imagine if there were 10 comments each second and there were 100 "Admins". Within a minute the time
array would have 100 items in it and I'd have done 1000 writes into the database.
If anyone has any suggestions on how to save this data well so that I can easily retrieve and store the data, I would love to hear it! Especially if it makes it easier when grabbing data like from the last day, week, etc.