connect-mongodb is a MongoDB session store backed by node-mongodb-native.
Originally written by dvv
Via git:
$ git clone git://github.com/masylum/connect-mongodb.git ~/.node_libraries/connect-mongodb
via npm:
$ npm install connect-mongodb
dbname
MongoDB db namehost
MongoDB server hostnameport
MongoDB server portnocollection
MongoDB collection to host sessions. 'sessions' by default.
var connect = require('connect')
, mongoStore = require('connect-mongodb');
connect.createServer(
connect.bodyDecoder(), // Always before the session
connect.cookieDecoder(),
connect.session({ store: mongoStore() })
);
If you use the bodyDecoder middleware, place it before the session one!