Global Template Helper Questions


#1

Hi, I’m trying to update a collection within a

Template.registerHelper( ‘getCouponCode’, (consumerId, couponCode) => {
// set the coupon code if it’s not already set
});

However, I’m seeing the following within the Firefox console:

exception: Meteor.consumers is undefined coupon-helpers-global.js:94:3
exception: couponCode is undefined

My observations:

I’m not sure why one cannot access a global collection using Meteor. Also, couponCode is passed into the method. I’m attempting to perform the following:

Meteor.consumers.update({_id: consumerId}, {$set: {couponCode: newCouponCode}});

BTW, I’m using Meteor 1.2. Can update operations be performed within a global template? Also, does Meteor
symbol have access to all the collections within the application?