I have a couchdb view with a reduce function
function(doc) {
if (doc.type === 'item') {
emit(doc.storeid + '-' + doc.feedid, parseInt(doc.sku));
}
}
The above query returns more than 30K results
My reduce function
function (key, values, rereduce) {
if (key.length > 1) {
var valueArray = new Array();
for (var i = 0; i < key.length; i++) {
valueArray.push(values[i]);
}
return valueArray;
} else {
return values;
}
}
The above reduce function returns the results as below
Key | Value
1234-5642 | [3232,54235,346332,34656,23425,443256343,234235,231]
0933-3122 | [34323,64343,1111]
However, where a single Key has more records say 30K+ the ARRAY values is NULL. Any suggestions on how best to improve the reduce function to return the values in the above results?