
CloudMagic Analytics – MongoDB finds its place - treskot
http://blog.cloudmagic.com/2012/11/16/cloudmagic-analytics-mongodb-finds-its-place/
======
ddorian43
So what are you actually using, simple queries (examples), map-reduce (is it
fast enough for you?), why not insert directly into mongodb, are you using the
new aggregate framework?

~~~
rishabhdua
We are using both simple queries and MapReduce. Simple queries like
db.cloudmagicAnalyics.count({type:'search', ts:{$gte:new Date('12 November
2012')}}); or say we need to find the number of users who searched
db.cloudmagicAnalyics.distinct('user_id', {type:'search', ts:{$gte:new
Date('12 November 2012')}}).length;

Map/reduce gives an edge as we don't need to process the info again in PHP.
For example we want to know how many users are searching in each platform.
Either we run multiple queries and get result or one single map/reduce
command.

Due to some technical limitations and to ensure our search speed is not
deteriorated, we decided to log all requests conditionally and then
asynchronously parse and insert them in MongoDB. My next blog post will
explain this better.

I have not given a whirl at Aggregate Framework, looks interesting, will try
it out.

