0

I have a list of generated users, which I filter like this:

roleShow: function() {
  var role = this.params.role
  return this.render('contactsList', {
    data: Meteor.users.find({ roles: role });
  });
}

When I create the users, I index their profile.name so that I can perform a search on it.

var id = Accounts.createUser({
  email: userData.email,
  profile: {
    name: userData.name + ' ' + userData.surname
  }
});
Roles.addUsersToRoles(id, userData.roles);
Meteor.users._ensureIndex({ "profile.name": "text" });

Now I am trying to filter on the client in a template.

Template.patientList.events({
  'input #search': function(e) {
    var results = Meteor.users.runCommand("text", {
      search: e.target.value
    });
  }
});

However, I can't perform runCommand on the Meteor.users collection. How could I perform this search?

(Note: I have enabled full text search already)

corvid
  • 10,733
  • 11
  • 61
  • 130

0 Answers0