store using mongodb.

npm install
18 downloads in the last week
82 downloads in the last month store implementation using mongodb.

This is a store using mongo based on the module by Oleg Slobodskoi. I updated the store to support the most recent versions of, mongo, and mubsub.


npm install

Usage example

var socketio = require(''),
    express = require('express'),
    MongoStore = require(''),
    app = express.createServer(),
    io = io.listen(app);


io.configure(function() {
    var store = new MongoStore({url: 'mongodb://localhost:27017/yourdb'});
    store.on('error', console.error);
    io.set('store', store);

io.sockets.on('connection', function (socket) {
    socket.emit('news', { hello: 'world' });
    socket.on('my other event', function (data) {


// Default options
   collectionPrefix: '' // collection name is prefix + name
  ,streamCollection: 'stream'     // capped collection name
  ,storageCollection: 'storage'   // collection name used for key/value storage
  ,nodeId: null // id that uniquely identifies this node
  ,size: 100000 // max size in bytes for capped collection
  ,num: null  // max number of documents inside of capped collection
  ,url: null  // db url e.g. "mongodb://localhost:27017/yourdb"
  ,host: 'localhost'  // optionally you can pass everything separately
  ,port: 27017
  ,db: 'mongsocketio'

new MongoStore(options);

Run tests

These tests are based on the same suite from and written using mocha.

npm loves you