express-sessions

ExpressJS MongoDB/Redis Session Storage

express-sessions

ExpressJS/MongoDB Session Store

npm install express-sessions

var mongoose = require('mongoose');

mongoose.connect();

app.use(express.session({ secret: 'a4f8071f-c873-4447-8ee2', cookie: { maxAge: 2628000000 }, store: new (require('express-sessions'))({ mongoose: mongoose, collection: 'sessions', cleanup_interval: 86400 }) }));

That's it!