源数据:

{
"_id" : 1.0,
"name" : "abc",
"age" : 43.0,
"type" : 1.0,
"status" : "P",
"favorites" : {
"artist" : "Picasso",
"food" : "pizza"
},
"finished" : [
17.0,
3.0
],
"badges" : [
"blue",
"black"
],
"points" : [
{
"points" : 85.0,
"bonus" : 20.0
},
{
"points" : 85.0,
"bonus" : 10.0
}
]
} /* 2 */
{
"_id" : 2.0,
"name" : "abc",
"age" : 42.0,
"type" : 1.0,
"status" : "A",
"favorites" : {
"artist" : "Miro",
"food" : "meringue"
},
"finished" : [
11.0,
25.0
],
"badges" : [
"green"
],
"points" : [
{
"points" : 85.0,
"bonus" : 20.0
},
{
"points" : 64.0,
"bonus" : 12.0
}
]
} /* 3 */
{
"_id" : 3.0,
"name" : "ahn",
"age" : 43.0,
"type" : 2.0,
"status" : "A",
"favorites" : {
"artist" : "Cassatt",
"food" : "cake"
},
"finished" : [
6.0
],
"badges" : [
"blue",
"red"
],
"points" : [
{
"points" : 81.0,
"bonus" : 8.0
},
{
"points" : 55.0,
"bonus" : 20.0
}
]
} /* 4 */
{
"_id" : 4.0,
"name" : "xi",
"age" : 34.0,
"type" : 2.0,
"status" : "D",
"favorites" : {
"artist" : "Chagall",
"food" : "chocolate"
},
"finished" : [
5.0,
11.0
],
"badges" : [
"red",
"black"
],
"points" : [
{
"points" : 53.0,
"bonus" : 15.0
},
{
"points" : 51.0,
"bonus" : 15.0
}
]
} /* 5 */
{
"_id" : 5.0,
"name" : "xyz",
"age" : 23.0,
"type" : 2.0,
"status" : "D",
"favorites" : {
"artist" : "Noguchi",
"food" : "nougat"
},
"finished" : [
14.0,
6.0
],
"badges" : [
"orange"
],
"points" : [
{
"points" : 71.0,
"bonus" : 20.0
}
]
} /* 6 */
{
"_id" : 6.0,
"name" : "abc",
"age" : 43.0,
"type" : 1.0,
"status" : "A",
"favorites" : {
"food" : "pizza",
"artist" : "Picasso"
},
"finished" : [
18.0,
12.0
],
"badges" : [
"black",
"blue"
],
"points" : [
{
"points" : 78.0,
"bonus" : 8.0
},
{
"points" : 57.0,
"bonus" : 7.0
}
]
}

  

var mrr=db.users.mapReduce(
function(){
emit(this.age,this.name);
},
function(key,values){
var a=Avalues.length;

var ret={age:key,names:a};
return ret;
},
{ out: {replace:"result"}}

);
db[mrr.result].find()

mongo学习- mapReduce操作事例的更多相关文章

  1. mongo学习-group操作以及java代码

    原数据: /* 1 */ { "_id" : ObjectId("552a330e05c27486b9b9b650"), "_class" ...

  2. mongo学习- group操作

    group可以使用 $sum,$avg,$max,$min,$first,$last

  3. Java中的函数式编程(七)流Stream的Map-Reduce操作

    写在前面 Stream 的 Map-Reduce 操作是Java 函数式编程的精华所在,同时也是最为复杂的部分.但一旦你啃下了这块硬骨头,那你就真正熟悉Java的函数式编程了. 如果你有大数据的编程经 ...

  4. 4-python学习——数据操作

    4-python学习--数据操作 参考python类型转换.数值操作(收藏) Python基本运算符 数据类型转换: 有时候,可能需要执行的内置类型之间的转换.类型之间的转换,只需使用类名作为函数. ...

  5. Mapreduce操作HBase

    这个操作和普通的Mapreduce还不太一样,比如普通的Mapreduce输入可以是txt文件等,Mapreduce可以直接读取Hive中的表的数据(能够看见是以类似txt文件形式),但Mapredu ...

  6. 安装Linux系统,学习Linux操作基础

    20189230杨静怡 2018-2019-2 <移动平台开发实践>第1周学习总结 安装Linux系统内容总结 一.学习"基于VirtualBox虚拟机安装Ubuntu图文教程& ...

  7. HBase 相关API操练(三):MapReduce操作HBase

    MapReduce 操作 HBase 在 HBase 系统上运行批处理运算,最方便和实用的模型依然是 MapReduce,如下图所示. HBase Table 和 Region 的关系类似 HDFS ...

  8. springboot学习-jdbc操作数据库--yml注意事项--controller接受参数以及参数校验--异常统一管理以及aop的使用---整合mybatis---swagger2构建api文档---jpa访问数据库及page进行分页---整合redis---定时任务

    springboot学习-jdbc操作数据库--yml注意事项--controller接受参数以及参数校验-- 异常统一管理以及aop的使用---整合mybatis---swagger2构建api文档 ...

  9. 7.MapReduce操作Hbase

    7 HBase的MapReduce   HBase中Table和Region的关系,有些类似HDFS中File和Block的关系.由于HBase提供了配套的与MapReduce进行交互的API如 Ta ...

随机推荐

  1. nginx防盗链配置

    Ps:防盗链的意义就是保证自己的版权,不免网站的流量流失,为他人做嫁衣.下面是网上看到的三种方法: 修改 /usr/local/nginx/conf/nginx.conf 这个配置文件.找到locat ...

  2. ETL流程概述及常用实现方法

    ETL流程概述及常用实现方法 http://blog.csdn.net/btkuangxp/article/details/48224187 目录(?)[-] 1抽取作业 1手工开发抽取作业时候的常用 ...

  3. 智能家居入门DIY——【五、执行命令】

    前面几篇介绍了ESP8266使用AT命令来连接WIFI实现一系列功能.这一篇介绍一下使用Wemos D1 Wifi来进行开发,当然也可以用常见的8针ESP8266来完成(只是需要按网上的方法将Ardu ...

  4. 访问https请求出现警告,去掉警告的方法

    在顶部引多一个包即可 from requests.packages.urllib3.exceptions import InsecureRequestWarning,InsecurePlatformW ...

  5. HDU 1969 Pie(二分,注意精度)

    Pie Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submiss ...

  6. mysql connection phase(未整理)

    14.2.1 初始握手初始握手从服务器发送 Initial_Handshake_Packet开始.在这之后,客户端可以选择是否通过SSL_Connection_Request_Packet发送SSL连 ...

  7. 详解Oracle的几种分页查询语句

    转载自:http://database.51cto.com/art/200904/118737.htm 分页查询格式: SELECT * FROM (SELECT A.*, ROWNUM RN FRO ...

  8. windows7配置Nginx+php+mysql的详细教程

    windows7配置Nginx+php+mysql的详细教程 作者:Vincent.李 字体:[增加 减小] 类型:转载 时间:2016-09-04我要评论 这篇文章主要介绍了windows7配置Ng ...

  9. selenium webdriver——JS对Input执行输入

    直接设置value属性, 此方法主要应对输入框自动补全以及readonly属性的element,sendkeys不稳定 比如: Demo:用JS输入 import org.openqa.seleniu ...

  10. leetcode131

    深度优先遍历(DFS),先判断前一个部分是否是回文,如果是,则将其加进集合中,然后继续判断后面的回文串. 在回溯的时候,将之前加入集合的串删除,重新选择回文串.每到达一次叶子节点,得到一组结果. pu ...