title: Session handling in mean stack
body: <p>I am new to MEAN stack, presently the mean stack is inserting sessions to mongodb:</p>
  
  <pre><code>app.use(session({
    saveUninitialized: true,
    resave: true,
    //cookie: { maxAge: 600  },
    secret: config.sessionSecret,
    store: newmongoStore({
      db: db.connection.db,
      collection: config.sessionCollection
    })
  })); 
  </code></pre>
  
  <p>But I want to save some custom variables in that session &amp; access them across requests, I did not get how to save it in session. Let's say I want to save <code>mydata</code> in session, I saw some examples &amp; tried like: </p>
  
  <pre><code>req.session.mydata = 'projectdata';
  req.session.cookie.mydata = 'projectdata';
  </code></pre>
  
  <p>Both are not working. Also I want to update <code>maxAge</code> variable on every request to server side, how to do it? Kindly help me.</p>