|
|
@@ -25,16 +25,15 @@ var GroupDocumentSource = module.exports = function GroupDocumentSource(expCtx)
|
|
|
base.call(this, expCtx);
|
|
|
|
|
|
this.populated = false;
|
|
|
- this._doingMerge = false;
|
|
|
- this._spilled = false;
|
|
|
+ this.doingMerge = false;
|
|
|
+ this.spilled = false;
|
|
|
this.extSortAllowed = expCtx.extSortAllowed && !expCtx.inRouter;
|
|
|
- this._maxMemoryUsageBytes = 100*1024*1024; // NOTE: This came from mongo
|
|
|
|
|
|
this.accumulatorFactories = [];
|
|
|
this.currentAccumulators = [];
|
|
|
this.groups = {}; // GroupsType Value -> Accumulators[]
|
|
|
this.groupsKeys = []; // This is to faciliate easier look up of groups
|
|
|
- this._variables = null;
|
|
|
+ this.variables = null;
|
|
|
this.fieldNames = [];
|
|
|
this.idFieldNames = [];
|
|
|
this.expressions = [];
|
|
|
@@ -101,7 +100,7 @@ proto.getNext = function getNext(callback) {
|
|
|
},
|
|
|
function(next) {
|
|
|
// NOTE: Skipped the spilled functionality
|
|
|
- if (self._spilled) {
|
|
|
+ if (self.spilled) {
|
|
|
throw new Error("Spilled is not implemented.");
|
|
|
} else {
|
|
|
if(self.currentGroupsKeysIndex === self.groupsKeys.length) {
|
|
|
@@ -266,7 +265,7 @@ klass.createFromJson = function createFromJson(elem, expCtx) {
|
|
|
|
|
|
if (!idSet) throw new Error("15955 a group specification must include an _id");
|
|
|
|
|
|
- group._variables = new Variables(idGenerator.getIdCount());
|
|
|
+ group.variables = new Variables(idGenerator.getIdCount());
|
|
|
|
|
|
return group;
|
|
|
};
|
|
|
@@ -300,10 +299,10 @@ proto.populate = function populate(callback) {
|
|
|
}
|
|
|
|
|
|
input = doc;
|
|
|
- self._variables.setRoot(input);
|
|
|
+ self.variables.setRoot(input);
|
|
|
|
|
|
/* get the _id value */
|
|
|
- var id = self.computeId(self._variables);
|
|
|
+ var id = self.computeId(self.variables);
|
|
|
|
|
|
if(undefined === id) id = null;
|
|
|
|
|
|
@@ -327,11 +326,11 @@ proto.populate = function populate(callback) {
|
|
|
|
|
|
//NOTE: passing the input to each accumulator
|
|
|
for(var gi=0; gi<group.length; gi++) {
|
|
|
- group[gi].process(self.expressions[gi].evaluate(self._variables, self._doingMerge));
|
|
|
+ group[gi].process(self.expressions[gi].evaluate(self.variables, self.doingMerge));
|
|
|
}
|
|
|
|
|
|
// We are done with the ROOT document so release it.
|
|
|
- self._variables.clearRoot();
|
|
|
+ self.variables.clearRoot();
|
|
|
|
|
|
//NOTE: Skipped the part about sorted files
|
|
|
|