I don't consider myself the right person to write detailed tutorials as I usually tend to omit a lot of details. but I 'd like to try out a different approach: I'll share with you the best materials I have found and used myself to learn about a specific feature. please do let me know if you'll find this approach useful.
Today will take a lookMongoDB mapreduce. As is normal (at least for making sure that we are getting rid of all future rtfm advice) We will start with☞Official documents. In MongoDB mapreduce case, the official documentation will provide us with details about:
- The complete command syntax
- Specs
Map
AndReduce
Functions
- As a bonus a couple of basic examples
There are also a couple of important aspects that you'll have to keep in mind while implementing your own MongoDB mapreduce functions:
- The mapreduce engine may invoke reduce functions iteratively; thus, these functions must be idempotent. That is, the following must hold for your reduce function:
For all K, Vals: reduce (K, [reduce (K, Vals)]) = reduce (K, Vals)
- Currently, the return value from a reduce function cannot be an array (it's typically an object or a number ).
- If you need to perform an operation only once, use a finalize function.
Knowing the basics, what I 've found to work well for me was to take a look at a simple but close to real life example. In this case I have chosen☞Following piece of code which implements a basic text search.
I have also found very useful to take a look at how SQL translates to mapreduce in MongoDB.
Just to make sure that I got things straight by now, I used the 3rd part of Kyle banker 'smongodb aggregation Tutorial: mapreduce basics.
The last step in learning about mapreduce in MongoDB was to take a look at some real usecases. Depending on your programming language preference, I 'd recommend one of these two MongoDB mapreduce usecases:
- RUBY: Visualizing log files with MongoDB, mapreduce, Ruby & Google charts:☞Part 1and☞Part 2
- Perl: Using MongoDB and mapreduce on Apache access logs☞
Summarizing our short tutorial on MongoDB mapreduce:
- ☞Official documents ents
- ☞Basic text search example
- Translate SQL to MongoDB mapreduce
- MongoDB aggregation Tutorial: mapreduce Basics
- MongoDB mapreduce usecases:
- Visualizing log files with MongoDB, mapreduce, Ruby & Google charts:☞Part 1and☞Part 2
- Using MongoDB and mapreduce on Apache access logs☞
In case you have other materials on MongoDB mapreduce that you consider essential please share them with us!
Reprinted from: MongoDB Tutorial: mapreduce