Reputation: 445
I wish to aggragate website statistics on 3 different levels:
On Mongo what is the recommended (performance wise) to store data that needs to be retrieved in the following matter:
{
"somedate": {
"324": {
"count": 456,
"subcampaigns": {
"fff": {
"count": 45,
"sources": {
"s1": {
"count": 4
},
"s2": {
"count": 41
}
}
}
}
}
}
}
the prediction is to have ~1M per day and "sources" > 10K would it be better to store in other collections or sub-jsons are good enough? Is there a limit size?
Thx
Upvotes: 1
Views: 126
Reputation: 499
There is a 16MB limit when you want to retrieve the result without writing on disk. Allow disk usage on aggregation slows it of course, but if you want to save the result to be able to request it after, writing the result in a collection is obviously the best choice.
By the way if you want to launch your request in back ground map/reduce might be a best solution, because it use way less memory and works quite transparently with it's yield system. You can even tack advantage of the incremental map reduce if you want to update your data without a huge cost (http://docs.mongodb.org/manual/tutorial/perform-incremental-map-reduce/).
Upvotes: 1