【发布时间】:2017-04-26 10:14:43
【问题描述】:
我创建了一个功能图,是这个
var m = function() {
hashtags = {}
for(var i in this.entities.hashtags) {
hashtags[this.entities.hashtags[i].text] = 1
};
var valor = {numtweets: 1 ,
dic_hastag: hashtags};
print(" value: " + tojson(valor));
emit(this.place.country_code, valor)
};
我从一个名为 tweets 的集合开始,我的 map 函数的输出应该有一个 variable numtweets: 1 和一个 variable hastags,其中包含 1 的整个 tweet hastats 列表。 例子 Nuwtweets: 1, hastags: "hast1": 1, "hast2": 2, "hast3": 1 1.-我可以将结果保存在一个集合中,以证明它运行良好而不是打印 2.-如果不是如果我必须做mapreduce,那么函数reduce应该是什么,为什么不做任何事情,所以在执行这个时,map函数的输出
Db.runCommand ({
MapReduce: "tweets",
Map: m,
Reduce: r,
Query: {"place.country_code": "AD"},
Out: {replace: "resultat5fi"}
});
任何建议、帮助、任何事情都将受到欢迎。
【问题讨论】:
标签: mongodb dictionary mapreduce