I’m having some difficulty handling issues with publish exactly the right data at the right time and with the right permissions and security in place.
This has led me to further investigate Meter.userId
as it relates to publish functions, and I’m wondering why the meteor docs have the label “Anywhere but publish functions” on these sections.
(I get that it is because they shouldn’t be relied on inside publish functions, but I’d like to understand why this has to be the case . Anyone got any links I might check out?)
Currently I’m using this pattern for all my publish functions (of which I have 19):
Meteor.publish("name", function () {
var user = Meteor.users.findOne(this.userId);
if (user) {
result1 = SomeCollection.find({some: data});
result2 = SomeCollection.find({some: data});
return [result1, result2]
}
});