3

I use Node.js express and express-session

I want to get all session or find session by sessionID in express-session

  • I had sessionID and want to find it
  • I want to check if user still logged in by check expires time
selfclose
  • 121
  • 3
  • 13
  • 1
    If you want to know this in a request handler for the user making the request, then the express-session middleware will tell you in req.session if the session is still alive or not. – jfriend00 Feb 17 '18 at 04:55
  • 1
    If you are outside of a request handler or want to look up another user, but have the sessionID, you can query the session store, using the `store.get()` method (whichever session store you are using). – jfriend00 Feb 17 '18 at 04:57

1 Answers1

-1

Please check below link

link

express-sessions store your all session in mongodb ,

you can get your all sessions using below query

db.getCollection('sessions').find({})

and use bellow query for find by sessionID

db.getCollection('sessions').find({'sessionID':"Your SessionID"})

Ashish Maradiya
  • 113
  • 1
  • 8