Get data only from subscription

Hey guys,
I’m having the following return in my publish function:

Meteor.publishComposite('results', function (limit) {
[...]
 return Users.find({
        'profile.search.status': myProfile.search.status,
        'profile.gender': {$in: myProfile.search.genders},
        'profile.birthday': {$gte: minDate, $lt: maxDate},
        'profile.search.genders': {$in: [myProfile.gender]},
        'profile.search.age_begin': {$lte: myAge},
        'profile.search.age_end': {$gte: myAge}

    },{limit:10});
});

Then I’m subscribing here:

Router.route('/results', {
name: 'results',
waitOn: function() { return [subs.subscribe('results',10)]; },
});

I’m also having a template helper:

'results': function () { 
[..the same code like in the publish method..] 
}

My question: Is it possible, to fetch only the the results of the subscription in the helper? I want to reduce the code of my helper class, because I’ve the same code in my publish and in my helper method.

No, it’s not possible. That’s one of the current pain points of Meteor’s pub/sub system.

But this might help avoid code duplication: https://www.discovermeteor.com/blog/query-constructors/

You can create a client-server shared object which will contain all props for the find. But it will require some voodoo with getting current user data on server :wink: