Listing all users on client with meteor
coffeescript, meteor
Solution
if you auto publish users collection without use subscribe
if Meteor.isServer
Meteor.publish null, ->
Meteor.users.find {},
fields:
username: 1
profile: 1
if you want to subscribe specify users you can
if Meteor.isServer
Meteor.publish 'users-by-selector', (options) ->
Meteor.users.find options, # options as selector like $in: name: 'john'
fields: # use fields to only publish specify fields you want to send.
username: 1
profile: 1
if Meteor.isClient
Meteor.autosubscribe ->
options = Session.get 'your mongodb selector'
Meteor.subscribe 'users-by-selector', options, ->
console.log 'on Subscribe Complete Callback.'
if Meteor.users.find().count()
Session.set 'specifyUsersLoaded', true
Problem
According the the meteor documentation, all users should be published to all clients if the autopublish package is installed. http://docs.meteor.com/#meteor_users I have the autopublish package installed, but using `forEach` on `Meteor.users` only lists the currently logged in user. Is there a more correct way to list all the users on the client by using coffeescript?