persistent sessions with passport, mongodb and express
问题 I'm using passport to handle authentication and sessions in my application. I'm persisting sessions to mongodb using mongostore. The setup works fine in general. However, when I restart the server all users are logged out, so apparently sessions are hold in memory instead of being only persisted to mongodb. I'm trying to achieve a setup where users are still logged in when restarting the server. Basic configuration is as follows middleware app.use(express.cookieParser('your secret here'));