title: Mongoose QueryStream new results
body: <p>I am trying to setup <a href="http://mongoosejs.com/index.html" rel="nofollow noreferrer">MongooseJS</a> to push out the whole collection (or just the newest item) when new documents are inserted into the collection by another application. </p>
  
  <p>I assumed <a href="http://mongoosejs.com/docs/api.html#querystream-js" rel="nofollow noreferrer">QueryStream</a> was the way to go. </p>
  
  <p>However, when I start my simple application, it reads out the collection once, and closes it.</p>
  
  <p>When I insert a new document nothing happens (assuming the connection is no longer open and looking for new results...?)</p>
  
  <pre><code>var Orders = db.model('orders', OrderSchema);
  
  var stream = Orders.find().stream();
  
  stream.on('data', function(doc){
      console.log('New item!');
      console.log(doc);
  }).on('error', function (error){
      console.log(error);
  }).on('close', function () {
      console.log('closed');
  });
  </code></pre>
  
  <p>Immediately prints all the items that are currently in the <em>orders collection</em>, and than prints "closed". Shouldn't the "Stream" remain open printing new data when the <em>collection changes</em>?</p>
  
  <p>What am I not understanding about the <code>MongooseJS QueryStream</code>?</p>
  
  <p>Ps. my goal is to eventually <code>emit</code> an updated collection via <code>socket.io</code> as demonstrated here: <a href="https://stackoverflow.com/questions/11075462/mongoose-stream-return-few-results-first-time?rq=1">Mongoose stream return few results first time</a></p>