A session extension for store session in MongoDB.
see Chinese version: 中文
$ npm i egg-session-mongo --save
// {app_root}/config/plugin.js
exports.sessionMongo = {
enable: true,
package: 'egg-session-mongo',
};
or you can overwrite you MongoStore
options in app.js
.
// {app_root}/app.js
module.exports = app => {
const MongoStore = require('egg-session-mongo')(app);
app.beforeStart(async () => {
app.sessionStore = new MongStore(/* options */);
});
};
see app.js for more detail.
// {app_root}/config/config.default.js
exports.sessionMongo = {
url: 'mongodb://127.0.0.1/test'
};
see config/config.example.js for more detail.
Please open an issue here. or open an issue just at this repo's issue for more timely reply