MongoDB Aggregation I: Counting and Grouping
kylebanker.com
kylebanker.com
In essence, they have implemented their Group function as a real simple Map/Reduce job, in which the "Map" phase is skipped partially Instead of completely decoupling the Map and Reduce phase, a Reduce is performed right after each object is Mapped: you perform a Reduce directly on the source object. Regular Map/Reduce frameworks usually decouple the Map and Reduce phase completely: you perform a Map on the source object, and a Reduce on all the emitted Map objects. This of course brings a lot of overhead (lots of Map objects emitted with just the value "1").
http://www.mongodb.org/display/DOCS/MapReduce
I was a bit disappointed that you couldn't set up a function to update "map" objects when the collection it was generated from is updated or added to. That was my favourite feature from CouchDB
I was a bit disappointed that you couldn't set up a function to update "map" objects when the collection it was generated from is updated or added to.
That sounds interesting, but it makes me wonder: what happens when an updated object is mapped again, as you describe? An update means that a previously mapped entry is deleted, so you should unreduce (inflate?) the previous map operation (which in many cases is not possible).
How are these things handled in Couch ?
I haven't really used the Map/Reduce functionality of Mongo yet, but I have poked at it a little. Basically, with MongoDB, you do a one-time transform from one "collection" of records to another. It doesn't automatically update the way CouchDB does, but I can do things like joins that I couldn't do with CouchDB.
Once again, Mongo's practicality makes me happy, while Couch gives me reason to admire but avoid.