Unable to get all userslist

In server

Meteor.users.find({}, {fields: {username: 1, emails: 1, profile: 1}});

In client

Template.allusers.onCreated(function() {
var self = this;
self.autorun(function() {


var usrs = Meteor.users.find();

I am getting only logged in user record.

Please help me


If you only need all users in your template allusers you really should use template level subscription. No need for autorun.

Template.allusers.onCreated(function() {
 var self = this;

you can then access the users via a template helper

  return Meteor.users.find();

To make sure the subscription is ready, check for it in the template

<template name="allusers">
 {{#if Template.subscriptionsReady}}
  {{#each user in allusers}}
  Loading ...

Thanks jamgold for your reply. I followed same steps, but still I am not getting the list of the users. For your information I have more fields in users profile collection, is this will give any problem for fetching?

More fields in the collection should not matter. The code I posted works for me, so maybe you need to share more code for people to help you.

You posted your publication like this:

    Meteor.users.find({}, {fields: {username: 1, emails: 1, profile: 1}});

If that is what your pub actually is, you aren’t returning anything. You are just running a query. You need to return the query for it to make it back to the client. Like so:

Meteor.publish('usersList1', function() {
    return Meteor.users.find({}, {fields: {username: 1, emails: 1, profile: 1}});

And then when you want to look at the users that you are currently subscribed to follow what @jamgold said.

Make sure you are using .fetch() so that you have an array of users instead of a cursor.


Damn, totally missed that :slight_smile: (even though I reflexively added it to my code snippet)


Thank you jpmoyn. I already used return statemtn. The issue resolved after I restarted the server by removing build folder in .meteor.
When I used console statements its not reflected the javascript change, dont know why?, so I restarted. Its working great now.

Thanks again jamgold