title: Meteor.js Publishing and Subscribing?
body: <p>Okay, so I am a bit confused about something with Meteor.js. I created a site with it to test the various concepts, and it worked fine. Once I removed "insecure" and "autopublish", I get multiple "access denied" errors when trying to retrieve and push to the server. I belive it has something to do with the following snippet: </p>
  
  <pre><code>Template.posts.posts = function () {
      return Posts.find({}, {sort: {time: -1}});
  }
  </code></pre>
  
  <p>I think that it is trying to access the collection directly, which it was allowed to do with "insecure" and "autopublish" enabled, but once they were disabled it was given access denied. Another piece I think is problematic:</p>
  
  <pre><code>else {
      Posts.insert({
      user: Meteor.user().profile.name,
      post: post.value,
      time: Date.now(),
  });
  </code></pre>
  
  <p>I think that the same sort of thing is happening: it is trying to access the collection directly, which it is not allowed to do.</p>
  
  <p>My question is, how do I re-factor it so that I do not need "insecure" and "autopublish" enabled?</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Final:</p>
  
  <pre><code>/** 
  * Models
  */
  Posts = new Meteor.Collection('posts');
  
  posts = Posts
  
  if (Meteor.isClient) {
  
      Meteor.subscribe('posts');
  
  
  }
  
  if (Meteor.isServer) {
  
      Meteor.publish('posts', function() {
          return posts.find({}, {time:-1, limit: 100});
     });
  
  
      posts.allow({
  
          insert: function (document) {
              return true;
          },
          update: function () {
              return false;
          },
          remove: function () {
              return false;
          }
  
      });
  
  }
  </code></pre>