title: Meteor Pub / Sub behaviour
body: <p>I'm currently implementing a realtime search function in my app and I've come across some behaviour which I'm confused about. </p>
  
  <p>The background is: I have two subscriptions from the same MongoDB database on my server, named <code>posts</code>. </p>
  
  <ol>
  <li><p>The first subscription subscribes to the latest 50 posts, and sends the data to the MiniMongo collection <code>Posts</code>.</p></li>
  <li><p>The second subscriptions subscribes to the post matching whatever search is entered by the user, and sends this data to MiniMongo collection <code>PostsSearch</code> as per below.</p>
  
  <pre><code>// client
  
  Posts = new Mongo.Collection('posts');
  
  PostsSearch = new Mongo.Collection('postsSearch');
  
  // server
  
  Meteor.publish('postsPub', function(options, search) {
  
      return Posts.find(search, options);
  
  });
  
  Meteor.publish('postsSearchPub', function(options, search) {
  
      var self = this;
  
      var subHandle = Posts.find(search, options).observeChanges({
  
          added: function (id, fields) {
  
              self.added("postsSearch", id, fields);
  
          }
  
      });
  
      self.ready();
  });
  </code></pre></li>
  </ol>
  
  <p>My question is, we know from the docs:</p>
  
  <blockquote>
    <p>If you pass a name when you create the collection, then you are
    declaring a persistent collection — one that is stored on the server
    and seen by all users. Client code and server code can both access the
    same collection using the same API.</p>
  </blockquote>
  
  <p>However this isn't the case with <code>PostsSearch</code>. When a user starts searching on the client, the functionality works perfectly as expected - the correct cursors are sent to the client.  </p>
  
  <p>However I do not see a <code>postsSearch</code> in my MongoDB database and likewise, <code>PostsSearch</code> isn't populated on any other client other than my own.</p>
  
  <p>How is this happening? What is <code>self.added("postsSearch", id, fields);</code> appearing to do that's it's able to send cursors down the wire to the client but not to the MongoDB database.</p>