[SOLVED] Sakulstra:aggregate with Meteor 2.6

Did you guys try to use the aggregate package sakulstra:aggregate with meteor 2.6.
According to the migration guide collection.rawCollection().aggregate() has changed and I suspect sakulstra:aggregate is using it.
Thanks for your reply

Hello again,
I have just saw that there is a pull request from @renanccastro

You rock guys!

If the package maintainer does not accept the pull request, does this mean I will have to fork it and copy it locally in my app ?

1 Like

Yes, that would be an option, @dokithonon.

Or maybe try to contact the maintainer to ask them to accept the PR.

ps: we also could add the package to the Meteor Compat Program and do it ourselves.


I had this problem and, to be fair, it’s probably easier to implement it yourself as part of your server side initialisation:

if (Meteor.isServer) {
    // set up a synchronous aggregate capability
    Mongo.Collection.prototype.aggregate = function(pipelines,options) {
        return Meteor.wrapAsync(function(callback) {
            this.rawCollection().aggregate(pipelines,options).toArray().then((result) => callback(null,result), callback);

Thanks for your message.
It appears that the repo has been taken over by meteor-compat and that they update the code to make it work with 2.6 : GitHub - meteor-compat/meteor-aggregate: Proper MongoDB aggregations support for Meteor
So it should be all good

1 Like

That’s right @dokithonon! The package author told us to assume it, so we did.

We are looking into adding this form of aggregation support to the Meteor core. For now, you can use the compat package. :slight_smile:

1 Like

Perfect timing. Just this morning I received a bug report from testing :sweat_smile:

1 Like