0

I'm trying to implement a search like in the thread: Meteor publish/subscribe strategies for unique client-side collections. I have wrapped the function in Meteor.startup as follows, but am still getting a reference error on the getSearchUsers function call.

Meteor.startup(function () {

    function getSearchUsers(query) {

        var re = new RegExp(query, "i");
        return Users.find({name: {$regex: re}});
    }

});
Community
  • 1
  • 1

1 Answers1

0

It may be the variable scoping. Try to write out the method with a global variable definition:

getSearchUsers = function(query) {

    var re = new RegExp(query, "i");
    return Users.find({name: {$regex: re}});
}
Tarang
  • 75,157
  • 39
  • 215
  • 276