I'm trying to perform an aggregation on the server part of my meteor application.
I've installed the mongodb-server-aggregation package, but when I do a simple aggregation like
var cursor = Tasks.aggregate(
[
{
'$group': {
'_id': '$code'
}
}
]
);
I get the following error
...
TypeError: Cannot call method 'collection' of undefined
at _futureWrapper (packages/mongodb-server-aggregation/server.coffee:17:31)
...
I probably do something wrong here, but I must say, I cannot find any examples too. Any help would be appreciated?
Looking at the package maybe comment out line 5 in server.coffee
MongoDB = Npm.require("mongodb")
Then I think it works.
Also, a bit of a technicality but line 8 has
Meteor.Collection which should be Mongo.Collection
If you only need it server side, why use the whole package? Fork it and then roll your own version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With