Meteor Accessing a single item in a collection


#1

I am very new to not only Meteor but script in general. I am having issues with a program. I have a collection storing times. I want to display each time in it’s own div. I have the collection set like this.

Timeslots = new Mongo.Collection(‘times’);
Timeslots.insert({Time: “8:00am”});
Timeslots.insert({Time: “8:30am”});
Timeslots.insert({Time: “9:00am”});
Timeslots.insert({Time: “9:30am”});
A helper function

Template.Available.helpers({
‘newtime’: function(){
return Timeslots.find()
}

});
I want to access each time to put it in its own div. So a div for 8:00am one for 8:30 etc.

My template html is

{{#each newtime}}

{{Time}

{{/each}}



However I have 20 times so 20 different divs. So one how do i access the value in the collection. Second how should I be changing this template so that it accesses the correct div? Thank you for advice and input. I am sure I am way off

Ok so in each dive I want a single value in the collection. So the first div is 8:00, the second 8:30, the 3rd 9:00. So in the collection (and only if my thinking is correct) that is value:0, 1, and 2. The div needs to be tied to a single time. I hope I am making sense


#2

I am not sure I understand. Maybe you could give an example of the html you want to generate?