diff --git a/lib/app.js b/lib/app.js index 97850ae..aac5ddf 100644 --- a/lib/app.js +++ b/lib/app.js @@ -1,7 +1,7 @@ var express = require('express') , app = express.createServer() , db = require('./db').db - , mongoStore = require('connect-mongodb'); + , MongoStore = require('connect-mongodb'); ; // expose the app as a module so everyone can use it @@ -34,7 +34,7 @@ app.configure(function(){ secret: 'secret', key: 'deployd.sid', cookie: {httpOnly: false}, - store: new mongoStore({db: db}) + store: new MongoStore({db: db}) })); app.use(app.router); app.use(express.static(__dirname + '/../public')); diff --git a/lib/db.js b/lib/db.js index eec7f5d..4bba1ce 100644 --- a/lib/db.js +++ b/lib/db.js @@ -90,8 +90,11 @@ module.exports = { collection(db, model, function(err, collection) { var index = {}; index[property] = 1; - - collection.ensureIndex(index, options, fn); + try { + collection.ensureIndex(index, options, fn); + } catch(e) { + console.error('MongoError:', e); + } }); })