title: Node.js Display data from Mongodb using sockets
body: <p>I would like to know how you can get data from MongoDB using a specific _id and using sockets. I am using Express, Node.js and MongoDB. This is what I have so far. The id that I use is the one a user gets when he is logged in (passport). Is there some easy and understanding way to fix this? I am quite new at this.</p>
  
  <p>www</p>
  
  <pre><code>socket.on('getSlide', function(a) {
    Slides.find({id: a.id}, function(err, slides) {
    if (err) { console.log(err); }
    socket.emit('getSlide', slides);
    });
  });
  </code></pre>
  
  <p>Script.js</p>
  
  <pre><code>socket.on('getSlide', function(getSlide) {
  var id = $(this).val();
  socket.emit('getSlide', {id: id});
  //append code that follows
  });
  </code></pre>