MongoDB에 초보자 인 MapReduce 호출을 시도하려고합니다. 는 불행하게도 나는 다음과 같은 오류 얻을 :Mongo Map 오류 줄이기
mongos> db.events.mapReduce(m,r,"errors");
Fri Apr 12 11:39:15.637 JavaScript execution failed: map reduce failed:{
"ok" : 0,
"errmsg" : "MR parallel processing failed: { errmsg: \"exception: reduce -> multiple not supported yet\", code: 10075, ok: 0.0 }"
} at src/mongo/shell/collection.js:L970
mongos>
내가 몽고 2.4.0을 사용하고 있습니다를
내 이벤트 컬렉션과 같습니다
{ "sid" : "1UADM45MCGRTW ", "time" : ISODate("2013-04-08T11:33:13.229Z"), "class" : "S", "service" : "service1" }
{ "sid" : "1UADM45MCGRTW ", "time" : ISODate("2013-04-08T11:33:13.229Z"), "class" : "I", "service" : "service1" }
{ "sid" : "1UADM45MCGRTW ", "time" : ISODate("2013-04-08T11:33:13.236Z"), "class" : "E", "text" : "error message" }
{ "sid" : "1UADM45MCGRTW ", "time" : ISODate("2013-04-08T11:33:13.239Z"), "class" : "F", "service" : "service1" }
{ "sid" : "1UDO3H7YUOK08 ", "time" : ISODate("2013-04-08T11:33:08.095Z"), "class" : "S", "service" : "service2" }
{ "sid" : "1UDO3H7YUOK08 ", "time" : ISODate("2013-04-08T11:33:08.095Z"), "class" : "I", "service" : "service2" }
{ "sid" : "1UDO3H7YUOK08 ", "time" : ISODate("2013-04-08T11:33:08.173Z"), "class" : "E", "text" : "another error message" }
{ "sid" : "1UDO3H7YUOK08 ", "time" : ISODate("2013-04-08T11:33:08.188Z"), "class" : "F", "service" : "service2" }
{ "sid" : "1UDO3JVXIS2UZ ", "time" : ISODate("2013-04-08T11:28:39.480Z"), "class" : "I", "service" : "service1" }
{ ""sid" : "1UDO3JVXIS2UZ ", "time" : ISODate("2013-04-08T11:28:39.480Z"), "class" : "S", "service" : "service1" }
{ "sid" : "1UDO3JVXIS2UZ ", "time" : ISODate("2013-04-08T11:28:40.853Z"), "class" : "F", "service" : "service1" }
{ "sid" : "1UDO3JVXIS2UZ ", "time" : ISODate("2013-04-08T11:28:40.852Z"), "class" : "I", "service" : "service1" }
내 의도가 얻을 수있는 모든 "E"입니다 "F"항목의 해당 "sid"의 "service"필드와 결합하십시오. 그래서 이것은 매우 간단해야하지만 나는 그것을 얻을 수 없었다 (위의 오류 때문에).
지도/I가 사용되는 기능 감소 : 서에 따라
var m = function() {
if (this.class == "E") {
value = { time: this.time, error: this.text };
emit(this.sid, value);
} else if (this.class == "F") {
value = { service: this.service };
emit(this.sid, value);
}
}
var r = function(key,values) {
return values;
}
db.events.mapReduce(m,r,"errors");
매우 도움이됩니다. 감사합니다. – pitseeker