mniam-store

session store for connect middleware using mniam mongo access layer

npm install mniam-store
2 downloads in the last week
8 downloads in the last month

Mniam Store

mniam-store is a connect session store backed by mongodb

mniam is used to access as a access layer which means no async on init, simple configuration and seamless connection sharing if your app is using DB

Installation

  $ npm install mniam-store

Options

  • db existing database created with mniam (can be shared with other parst of the app)
  • collection name of the mongo collection to keep sessions in (default: sessions)
  • reapInterval (millis) how often expired sessions should be purged - set to -1 to stop purging
  • ttl - (millis) specifies how long sessions should stay in DB - defaults to session cookie maxAge, and if that is not specified either -- to 1 day

Usage

Similar to other connect session stores.

var connect = require('connect');
var mniam = require('mniam');
var MniamStore = require('mniam-store')(connect);

// use DB for mniam store only or share it with other parts of the app
var db = mniam.db('mongourl://localhost/database');

connect().use(connect.session({
  store: new MniamStore({
    db: db
  })
}))

If you use express you may do the following:

var RedisStore = require('connect-redis')(express);

License

MIT

npm loves you