|
|
@ -33,14 +33,13 @@ Storage.prototype.connect = function(opts, cb) { |
|
|
|
if (this.db) return cb(null); |
|
|
|
|
|
|
|
var config = opts.mongoDb || {}; |
|
|
|
var url = 'mongodb://' + (config.host || 'localhost') + ':' + (config.port || 27017) + '/bws'; |
|
|
|
mongodb.MongoClient.connect(url, function(err, db) { |
|
|
|
mongodb.MongoClient.connect(config.uri, function(err, db) { |
|
|
|
if (err) { |
|
|
|
log.error('Unable to connect to the mongoDB server.'); |
|
|
|
log.error('Unable to connect to the mongoDB server on ', config.uri); |
|
|
|
return cb(err); |
|
|
|
} |
|
|
|
self.db = db; |
|
|
|
console.log('Connection established to ', url); |
|
|
|
console.log('Connection established to ', config.uri); |
|
|
|
return cb(null); |
|
|
|
}); |
|
|
|
}; |
|
|
|