title: Retrieve sessions list from sessionStore and destroy user previous sessions NodeJS
body: <p>I need to retrieve a list sessions from sessionStore(MongoStore) and delete previous login session. I am using express-session to store sessions in DB.</p>
  
  <pre><code>var userId = req.query.userid;
    if (!userId)
      return res.status(400).send({
        message: errorHandler.getErrorMessage('No user found in input request')
      });
  
    var store = req.sessionStore;
    var sessionsColl = store.db.collection('sessions');
  
    sessionsColl.find({
      'session.passport.user': userId,
      '_id': { '$ne': req.sessionID }
    }, function (err, userSessions) {
      console.log(userSessions);
      if (userSessions !== null &amp;&amp; typeof userSessions._id !== 'undefined') {
        store.destroy(userSessions._id, function (err, dat) {
          console.log(dat);
        });      
      }
    });
  </code></pre>
  
  <p>But in <strong>userSessions</strong> object i am getting an object instead of collection and I could not understand how can I fetch list of sessions from <strong>userSessions</strong> object</p>
  
  <p><a href="https://i.stack.imgur.com/ZFj7r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZFj7r.png" alt="userSessions object response"></a></p>