2011-09-20 5 views
0

지도를 Mongo로 바로 이동하여 최상위 태그를 얻으려고하지만이 오류가 발생하고 어떤 의미인지, 그 이유는 무엇인지 모르겠습니다. 어떤 지침?지도 축소 오류 : MongoDB

> reduce= function(previous, current) { 
... var count = 0; 
... 
...  for (index in current) { 
...   count += current[index]; 
...  } 
... 
...  return count; 
... } 
function (previous, current) { 
    var count = 0; 
    for (index in current) { 
     count += current[index]; 
    } 
    return count; 
} 
> reduce 
function (previous, current) { 
    var count = 0; 
    for (index in current) { 
     count += current[index]; 
    } 
    return count; 
} 
> map = function() { 
... if (!this.stores) { 
... return; 
...  } 
... for (index in this.stores) { 
... emit(this.stores[index], 1); 
... } 
... } 
function() { 
    if (!this.stores) { 
     return; 
    } 
    for (index in this.stores) { 
     emit(this.stores[index], 1); 
    } 
} 
> map 
function() { 
    if (!this.stores) { 
     return; 
    } 
    for (index in this.stores) { 
     emit(this.stores[index], 1); 
    } 
} 
> result = db.runCommand({ 
... "mapreduce" : "users", 
... "map" : map, 
... "reduce" : reduce, 
... "out" : "tags"}) 
{ 
    "assertion" : "_id cannot be an array", 
    "assertionCode" : 10099, 
    "errmsg" : "db assertion failure", 
    "ok" : 0 
} 

답변

1
"assertion" : "_id cannot be an array" 

당신의 this.stores [인덱스] 배열은 맵리 듀스 결과가

키지도로 _ID 한 원인이되고 있음을 의미 할 수 있습니다