How are connect-mongo MongoStore sessions actually saved? How are connect-mongo MongoStore sessions actually saved? mongodb mongodb

How are connect-mongo MongoStore sessions actually saved?


connect-mongo stores sessions in the "sessions" collection by default. They should be there and visible in the mongo shell or any GUI tool like robomongo. Yes, it is created by default. I would pass in the mongooose_connection option instead of db.

From the docs:

mongoose_connection in the form: someMongooseDb.connections[0] to use an existing mongoose connection. (optional)


One thing you should do is replace

app.use(connect.session({ secret: 'ilovescotchscotchyscotchscotch' }));

with your

app.use(session({  secret: 'ziKologiia',  clear_interval: 900,  cookie: { maxAge: 2 * 60 * 60 * 1000 },  store: new MongoStore({    db: mongoose.connection.db  });}));