Not able to display the aggregation values in template

I am able to get the aggreate values from server to
client, but could not display it on the template. Am i missing something
here.Appreciate your help. iam using meteorhacks/meteor-aggregate package.

//client side javascript



        var res;"getAggregateCategoriesSum",function(errors,results){

        console.log("results value: "+ JSON.stringify(results))

        return results ;


//stringfy value returned

results value:



        {{#each  CategoryAggregateItem}}


you cannot return async callback there.

best practice is to assign results to some reactive source, for example ReactiveVar and than just return that ReactiveVar in helper.

onCreated template part is your friend

thanks for direction, i have done that but getting the following error. Not sure what iam missing here.
my client.js file
return this.CategoryAggregateItem;
Template.DashboardCategoriesChart.onCreated(function () {
this.CategoryAggregateItem = new ReactiveVar(null);“getAggregateCategoriesSum”,function(errors,results){
console.log("results value: "+ JSON.stringify(results))

Getting the following error.
Exception in delivering result of invoking ‘getAggregateCategoriesSum’: TypeError: Cannot read property ‘set’ of undefined

this in callback have other scope
I suggest in onCreated

var instance = this;

and than in callback use


in helper

1 Like

Look at the meteor-reactive-method package…

Brilliant! works like a charm. got struck for 2 days. Thanks a ton.