Need i publish and subscribe to meteor.users if i remove autopublish package?


on the client, I get user’s openid by Oauth2.0, so the user doesn’t need to login the accounting system. but I want get the user’s name from user database by this openid. I get user’s name like this,

var seller = Meteor.users.findOne({“profile.openid”:openid}).username;

I have removed autopublish package, and I have tried publish and subscribe meteor.users like this, but it didn’t works

// on server
Meteor.publish(‘allUsers’, function() {
return Meteor.users.find();

// on client

by the way, who can tell me how to add the grey background for codes, I simply can’t find it.



Yes you have to subscribe. But note that Meteor.users.find() returns only _id and profile fields by default. So you shod use it like: Meteor.users.find({}, {fields: {username: 1, name: 1}})

And I guess you should check if the publish cursor has documents

// on server
Meteor.publish('allUsers', function() {
    cursor = Meteor.users.find({});
    return cursor;


Since when does Meteor.users.find() filter the fields to only return _id and profile?


For code you can also use three back ticks on a line followed by a language designator then another three back ticks on a separate line with your code block sandwiched inbetween

var message = "Hello World";


var message = "Hello World";