Try it with using "map" from Underscore.js.
I'm expecting you have movies in your "Movie" collection and they look something like this:
{
title: "Shawshank Redemption",
score: 92
},
{
title: "Forrest Gump",
score: 96
},
{
title: "Green Mile",
score: 91
},
{
title: "The Godfather",
score: 95
}
... and so on ...
And here is "yourTemplate" helper function:
Template.yourTemplate.helpers({
movie: function () {
var loadMovies = Movie.find({}, {sort: {score: -1}, limit: 20}).fetch(); // added descending sorting by review score
var array = _.map(loadMovies, function(movie, index) {
return {
number: index+1, // incrementing by 1 so you won't get 0 at the start of the list
movie_name: movie.title,
review_score: movie.score
};
});
return array;
}
});
So now you can use it in your template like this:
<template name="yourTemplate">
{{#each movie}}
Movie #{{number}} {{movie_name}} {{review_score}}
{{/each}}
</template>