Having issues with .find in iron router 'data' function


#1

Each of the post has a name.I want to display the name of the post returned by data function in the searchresults template but I couldnt find a way to do so.How can I write each command in the template so that the name of each post returned by data function is displayed.

Router.route('/posts/search/:somesearch/',{
    template:'searchresults',
    name:'searchresults',
  data: function(){
    var searchbox=document.getElementById('searchbox').value;
    var search=new RegExp('\\b'+searchbox+'\\b','i');
    return Posts.find({ name: search }).fetch();
  } ,
});