|
|
@@ -100,9 +100,9 @@ proto.getNext = function getNext(callback) {
|
|
|
return next();
|
|
|
},
|
|
|
function(next) {
|
|
|
+ // NOTE: Skipped the spilled functionality
|
|
|
if (self._spilled) {
|
|
|
- // NOTE: this got skipped before, work on it
|
|
|
- throw new Error("Spilled isn't finished.");
|
|
|
+ throw new Error("Spilled is not implemented.");
|
|
|
} else {
|
|
|
if(self.currentGroupsKeysIndex === self.groupsKeys.length) {
|
|
|
return next(null, DocumentSource.EOF);
|
|
|
@@ -110,7 +110,7 @@ proto.getNext = function getNext(callback) {
|
|
|
|
|
|
var id = self.groupsKeys[self.currentGroupsKeysIndex],
|
|
|
accumulators = self.groups[id],
|
|
|
- out = self.makeDocument(id, accumulators, self.expCtx.inShard);
|
|
|
+ out = self.makeDocument(JSON.parse(id), accumulators, self.expCtx.inShard);
|
|
|
|
|
|
if(++self.currentGroupsKeysIndex === self.groupsKeys.length) {
|
|
|
self.dispose();
|
|
|
@@ -307,12 +307,13 @@ proto.populate = function populate(callback) {
|
|
|
|
|
|
if(undefined === id) id = null;
|
|
|
|
|
|
- var group = self.groups[JSON.stringify(id)];
|
|
|
+ var groupKey = JSON.stringify(id),
|
|
|
+ group = self.groups[groupKey];
|
|
|
|
|
|
if(!group) {
|
|
|
- self.groupsKeys.push(id);
|
|
|
+ self.groupsKeys.push(groupKey);
|
|
|
group = [];
|
|
|
- self.groups[id] = group;
|
|
|
+ self.groups[groupKey] = group;
|
|
|
// Add the accumulators
|
|
|
for(var afi = 0; afi<self.accumulatorFactories.length; afi++) {
|
|
|
group.push(new self.accumulatorFactories[afi]());
|