I have some data i want to retrieve from one of my collections. The data i want to receive will not be printed out to the template but rather used internally in one of my functions somewhere.
This is the code
var mynumber = Session.get('number');
var my_friends = Kontacts.find({my_number: mynumber}).fetch();
console.log(my_friends);
for (i in my_friends)
{
console.log(my_friends[i].contact_number);
}
This console.log(my_friends);
returns an empty array.
I have subscribed and even published my collection. Is this the meteoric way of returning an array from a collecton?.