Document the Accounts.addAutopublishFields function


#1

I’ve just happened to stumble upon this function in

Had I known it existed, it would’ve saved me a massive headache and time

Is there any work planned on extending the documentation for such obscure, yet useful features?


#2

hey @chenroth,

I was wondering if you can help me with the Accounts.addAutopublishFields function.
In fact, I want to auto publish the roles field for logged in users, but my code doesn’t seem to work.

In server/main.js I have:

Accounts.addAutopublishFields({
    forLoggedInUser: ['roles'],
});

But when I log Meteor.user() on client side, I don’t get the roles field:
image

I would appreciate your help.

Thank you very much.