diff --git a/lib/query/aggregate.js b/lib/query/aggregate.js index 4fd06911f..9964145d8 100644 --- a/lib/query/aggregate.js +++ b/lib/query/aggregate.js @@ -50,25 +50,25 @@ Aggregate.prototype.build = function build(options) { // Build up the group for the $group aggregation phase if(Array.isArray(options.sum)) { options.sum.forEach(function(opt) { - self.group[opt] = { '$sum': '$' + opt }; + self.group[opt.replace(/\./g,"-")] = { '$sum': '$' + opt }; }); } if(Array.isArray(options.average)) { options.average.forEach(function(opt) { - self.group[opt] = { '$avg': '$' + opt }; + self.group[opt.replace(/\./g,"-")] = { '$avg': '$' + opt }; }); } if(Array.isArray(options.min)) { options.min.forEach(function(opt) { - self.group[opt] = { '$min': '$' + opt }; + self.group[opt.replace(/\./g,"-")] = { '$min': '$' + opt }; }); } if(Array.isArray(options.max)) { options.max.forEach(function(opt) { - self.group[opt] = { '$max': '$' + opt }; + self.group[opt.replace(/\./g,"-")] = { '$max': '$' + opt }; }); } };