Problem Autocomplete Meteor.users

Hi!

I want to do a autocomplete input so I use the package: https://github.com/mizzao/meteor-autocomplete. I want to have all username of DB but when I use Meteor.users I have only the username of the user connected. I need a Collection with usernames:

js.

Template.foo.helpers({
settings: function() {
return {
position: “down”,
limit: 8,
rules: [
{
collection: Meteor.users, //It is the problem
field: “username”,
template: Template.userPill
}
]
};
}
});

Sorry for my english,

Thanks!

Meteor by default only publishes (and subscribes to) the currently logged in user to the client.

So how do I use subscribe or I can not do it ?

Thanks ! :grinning:

You need to create a publication for all the other users. For security reasons Meteor does not do this by default, so think long and hard. You can create a Method that resolves whatever is being typed into the autocomplete. I recently did that for a problem I had where I did not want to publish/subscribe 1000s of records to make autocomplete work. Don’t know if meteor-autocomplete supports that though.

1 Like