试图按日期和数字分组
我的文件
{ "_id" : ObjectId("4f956dee76ddb26752026e8f"), "request" : "default", "options" : "1", "keyword" : "somekey", "number" : "5b234b79-4d70-437e-8eef-32a2941af40a", "date" : "20120423200446", "time" : 1335193066 }
我的查询
map = "function() { var date = new Date(this.time * 1000); var key = date.getFullYear() + date.getMonth() + date.getDate(); emit({day : key, number: this.number}, {count: 1}); }"
reduce = "function(key, values) { var count = 0; values.forEach(function(v) { count += v['count']; }); return {count: count}; }"
db.txtweb.mapReduce(map, reduce, {out: "pageview_results"});
我的错误
uncaught exception: map reduce failed:{ "errmsg" : "ns doesn't exist", "ok" : 0 }
我不知道出了什么问题,但我认为它是用日期功能做的。
有任何想法吗。