Publish Handler issue in Meteor.publish

Hi. I was publishing some documents using Meteor.publish function. I have found that the this keyword which should be publish handler object, is not the required object when we use arrow functions as the second argument to Meteor.publish function.

// this is correct
Meteor.publish(‘vehiclesCount’, function(options) {
console.log(this.added) // [Function: added]
}

// this is incorrect
Meteor.publish(‘vehiclesCount’, (options) => {
console.log(this.added) // undefined
}

Is this how it is supposed to behave ?


this might help you understand