MongoDB Tutorial: mapreduce

Source: Internet
Author: User
Tags mongodb tutorial

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
    • SpecsMapAndReduceFunctions
    • 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:

    1. 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)

    2. Currently, the return value from a reduce function cannot be an array (it's typically an object or a number ).
    3. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.