Since we can structure MongoDB in 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 }} ] }
as we add data to it day after day, the products and brands document will become more and more. In 3 years there will be a thousand elements in products and brands . Isn't that good for MongoDB? Should we break it 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, in 3 years there will be only 2,000 “documents”?