title: req.session returns wrong value
body: <p><strong>app.js</strong></p>
  <pre><code>const mongoose = require('mongoose');
  const session = require('express-session');
  const MongoDBStore = require('connect-mongodb-session')(session);
  
  
  const MONGODB_URI =
    'mongodb+srv://@cluster0-szxlh.mongodb.net/shop';
  
  
  const store = new MongoDBStore({
    uri: MONGODB_URI,
    collection: 'sessions'
  });
  
  
  app.use(
    session({
      secret: 'my secret',
      resave: false,
      saveUninitialized: false,
      store: store
    })
  );
  
  
  app.use((req, res, next) =&gt; {
    console.log(&quot;in app&quot;);
    res.locals.isAuthenticated = req.session.isLoggedIn;
    res.locals.isShopAuthenticated = req.session.isShopLoggedIn;
    res.locals.isUserAuthenticated = req.session.isUserLoggedIn;
    res.locals.islat=req.session.lat;
    res.locals.islang=req.session.lang;
    res.locals.csrfToken = req.csrfToken();
    console.log(req.session.lat); //returns wrong(previous)value
    console.log(req.session.lang); //returns wrong(previous)value
    next();
  });
  app.use(function (req, res, next) {
    res.set('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0');
    next();
  });
  </code></pre>
  <p><strong>post request which sets the cookie</strong></p>
  <pre><code>exports.postHome=(req,res,next)=&gt;{
      const lattitude=req.body.lattitude;
      const longitude= req.body.longitude;
      req.session.lat=lattitude;  //setting session
      req.session.lang=longitude; 
      req.session.save();
      console.log(&quot;inpost&quot;);
      console.log(lattitude);
      console.log(longitude);
      res.redirect('/');
    }
  </code></pre>
  <p>I have used routes after the session middleware.
  I have checked in database the value got updated but req.session.lat in app.js returns previously updated value some times</p>
  <p><strong>logs</strong></p>
  <p>inpost
  13.336614284510889
  80.19245464019774 in app
  13.336614284510889
  80.19245464019774</p>
  <p>inpost
  13.334818684323631
  80.18992263488768 in app
  13.336614284510889 (check it returns previous value sometimes)
  80.19245464019774</p>