Since we can structure a MongoDB any way we want, we can do it this way
{ products:
[
{ date: "2010-09-08", data: { pageviews: 23, timeOnPage: 178 }},
{ date: "2010-09-09", data: { pageviews: 36, timeOnPage: 202 }}
],
brands:
[
{ date: "2010-09-08", data: { pageviews: 123, timeOnPage: 210 }},
{ date: "2010-09-09", data: { pageviews: 61, timeOnPage: 876 }}
]
}
so as we add data to it day after day, the products
document and brands
document will become bigger and bigger. After 3 years, there will be a thousand elements in products
and in brands
. Is it not good for MongoDB? Should we break it down more into 4 documents:
{ type: 'products', date: "2010-09-08", data: { pageviews: 23, timeOnPage: 178 }}
{ type: 'products', date: "2010-09-09", data: { pageviews: 36, timeOnPage: 202 }}
{ type: 'brands', date: "2010-09-08", data: { pageviews: 123, timeOnPage: 210 }}
{ type: 'brands', date: "2010-09-08", data: { pageviews: 61, timeOnPage: 876 }}
So that after 3 years, there will be just 2000 "documents"?