mapreduce - 如下场景的mongodb的查询...
伊谢尔伦
伊谢尔伦 2017-04-27 09:02:22
0
1
616

数据样式如下,如何用mapReduce进行统计 性别是男性的小孩有多少? (小朋友的性命未知,数据结构感人!_!)
一个db的集合里大约有百万级的这样的数据

{
    "name":"向日癸班的小贫油",
     "小新":{
             "姓名":"小新",
             "年龄":"6",
             "性别":"男"       
      },
      "妮妮":{
             "姓名":"妮妮",
             "年龄":"7",
             "性别":"女"       
      },
      "风间":{
             "姓名":"风间",
             "年龄":"7",
             "性别":"男"       
      },
      "阿呆":{
             "姓名":"阿呆",
             "年龄":"6",
             "性别":"男"       
      },
      .
      .
      .
      .
      .
      

}
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
仅有的幸福

Use MapReduce for statistics on this data structure. I wonder if the poster has found a solution? First of all, it is not possible to determine how many images a record has

 "阿呆":{
             "姓名":"阿呆",
             "年龄":"6",
             "性别":"男"       
      }

With such data, and the key of the map is not fixed, it is difficult to locate the gender field. The implementation I can think of is to do statistics in the program, that is, take it out from the database. If the author has implemented MapReduce statistics, I would like to share the implementation, thank you

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template