This code publishes some documents from ActiveTaskCol based on a given projection as shown.
I need to re-run this publish when ActiveTaskCol.insert(… takes place anywhere else in the project, since the value of currentAction will change.
I thought it will by reactive but I was wrong. How can this be achieved?
I tried to wrap the code in autorun function for no avail
Thanks
Server.js
Meteor.publish('attributes', function () {
var currentAction = ActiveTaskCol.findOne({}, {fields: {action:1}, sort: {createdAt: -1}, limit: 1}).action;
return Attributes.find({action: currentAction});
});