I originally thought my collection wasn't receiving data, but it turns out I just had a typo in my query. But my data still isn't appearing on the screen. The HTML template is pretty basic, here it is:
<template name="messages" class=".messages">
{{#each showMessages}}
<blockquote>
<p>{{message}}</p>
</blockquote>
{{/each}}
</template>
It's supposed to just make the collection of messages appear when I call {{> messages}} Here's the client side JS that corresponds to it:
Meteor.subscribe("Messages");
Template.messages.helpers({
showMessages: function(){
return Meteor.call("find");
}
});
and here's the server method:
Meteor.methods({
insert:function(username, message){
var id = Messages.insert({
'message': message,
'user': Meteor.userId(),
'username': username,
'timestamp': new Date()
});
return "success";
},
'find': function(){
return Messages.find({},{sort:{timestamp:-1}}, 20).fetch();
}
});
I'm pretty new to MeteorJS, I just picked it up yesterday, so it's probably something really basic that I am missing, but I've been slamming my head against this for 2 hours and have made 0 progress. I don't have insecure or autopublish enabled. This isn't meant to be a usable product or anything, I'm using this to teach myself, so I know that I am doing some insecure things.