Problems in listing users with autopublish ON



I’m currently prototyping a project and therefore I did not switch autopublish off right now. Now I want to display a simple list of users but I only get the details of the current logged in user in my list while for all other users I only get an {"_id":“SOME_ID”} document returned.

I also tried to do a manual publication with:

if (Meteor.isServer) {
    Meteor.publish('users', () => Meteor.users.find({}));

but this did not work out.

All other collections work as expected. Am I missing something here? Is the publication of all users somehow prevented, when autopublish is still on or might there be some issue that data is not loaded in the client?

I’d be glad for some helpful hints. :slight_smile:


Try returning the cursor.

Meteor.publish('users', () => {
    return Meteor.users.find({})


Thanks for this input but this does not solve the problem since it’s just a different syntax in ES6.

Meteor.publish('users', () => Meteor.users.find({}));


Meteor.publish('users', () => {
    return Meteor.users.find({});

are semantically same. I also tried a named function with it’s own function scope:

Meteor.publish('users', function publishUsers() {
    return Meteor.users.find({});

but unfortunately this didn’t work too.


Ok, I’ve got my problem solved. It was just a dead simple fail, that I did forget to import my users publication in my server/main.js. My publication was located in imports, an was therefore not imported automatically.