monogodb関連mapreduce文章共有

4106 ワード

1、http://www.mongovue.com/2010/11/03/yet-another-mongodb-map-reduce-tutorial/
この文章の中で重要な知識点は:
Reduce Taes 2 parameters–1)Key 2)An array of values(number of values output d from Map step).Output of Reduce is an object.It is importnt to note Reduce can be can be cand multimes single!Yes,you read itcorectly.It is not that difficult to thininactually–considea case aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaduced values.
The picture above shows Reduce being caled twice.This just can example.To be frank,we don’t know how MongoDB executes Reduce.We don’t know w w w hihich key ititititititititititititititititititititititititititititititititit isgodididididididigggggggggreducte e e for a.Theefffttttttttttttffffftititititifefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefee e e e e e e e e e e e e e e e e e e e e e aaaaaaaaaduce command.
また、例では、reduce解析の2枚目の画像と説明があります.
mongodb有关mapreduce文章分享_第1张图片
2、http://www.infoq.com/cn/articles/implementing-aggregation-functions-in-mongodb
このブログは主に具体的な例と文を参考にしてmapreduceを理解します.
この二つはreduceの原理について詳しく書きました.また、オフィシャル文書のmapredeuceについての描写もあります.
3、http://docs.mongodb.org/manual/reference/command/mapReduce/#dbcmd.mapReduce
公式文書では、以下の部分が考えられます.
  • the タイプ of the return object must be identical to the type of the value emited by the map function to ensure that the follwing operation s is true:
    reduce(key, [ C, reduce(key, [ A, B ]) ] ) == reduce( key, [ C, A, B ] )
    
  • the reduce function must be ideampotent.Ense that the follwing statement is true:
    reduce( key, [ reduce(key, valuesArray) ] ) == reduce( key, valuesArray )
    
  • the order of the elements in the valuesAray Shuld not affect the output of the reduce function、so that the follwing statement is true:
    reduce( key, [ A, B ] ) == reduce( key, [ B, A ] )
  • よく磨いてください.道はまだ長いです.