diff --git a/index.js b/index.js index 62bd4ed..a862a61 100644 --- a/index.js +++ b/index.js @@ -10,3 +10,15 @@ Mongo.Collection.prototype.aggregate = function(pipelines, options) { } return wrapAsync(coll.aggregate.bind(coll))(pipelines, options); } + +Mongo.Collection.prototype.aggregateAsync = function() { + var collection; + if (this.rawCollection) { + // >= Meteor 1.0.4 + collection = this.rawCollection(); + } else { + // < Meteor 1.0.4 + collection = this._getCollection(); + } + return collection.aggregate.call(collection, Array.prototype.slice.call(arguments)); +}