I am starting to work on CouchDB for collecting analytical information from Facebook Insights and other sources. I am not sure about a proper design of a document and would like more experienced CouchDB users to see it and warn me if I am about to make any big mistake.
{
"_id": "0b69a33807d4cb63680dbebc16000af5",
"_rev": "1-7c9916592c377e32cf83acf746a8647c",
//array of metrics, one element per facebook page, around 10 pages per document**
"metrics": [
{
"sourceId": "210627525692699", //facebook page ID
"source": "facebook",
"values": {
"page_likes": 53
//many more other metrics, around 100
}
},
{
"sourceId": "354413697924499", // //facebook page ID
"source": "facebook",
"values": {
"page_wall_posts_source_unique": {other: 0, composer: 1},
"page_likes": 12
//many more other metrics, around 100
}
}
],
"timestamp": [
2012,
10,
15,
10,
0,
0
],
"customerId": "71ff942f-9283-4916-ab84-4927bce09117"
}
Expected number of documents: +10 000 every hour, +240 000 every day.
Expected requests to the documents:
- sum of values per customer, per sourceId, per metric in a given time period
- specialized views for more complex metrics
Questions:
- In order to get analytics for some complex metrics (like page_wall_posts_source_unique) we will need to build specialized views, probably many of them, should I expect problems with view update time?
- Is it right decision to use an array for the timestamp, or it is better to use a long?
- Should I use one design document or put every view in a new one?