title: Add data to session in nodejs express in a callback
body: <p>In the below code i'm trying to fetch the user details from DB and save it to session. But unfortunately it doesn't work as i've expected, the data is not written into the session variable. I guess it's because of pass by value? Any workaround</p>
  
  <pre><code>
  exports.check = function(req,res,next){
      ..
      ..
      getUserFromDB(req);
  }
  
  function getUserFromDB(req){
      ..
      db.findOne(query,function(doc){
          req.session.user = doc;
      })
  }
  </code></pre>