var mongoose = require('mongoose');
var config = require(softblu + 'config');
var deferred = require(softblu + 'util/deferred');
var ready = deferred();
var db;

function init () {
    mongoose.connect(config.databaseUrl);
    db = mongoose.connection;

    db.on('error', function (err) {
        console.log('Failed to establish connection with database');
        ready.reject(err);
    });

    db.once('open', function () {
        console.log('Connection to database established');
        ready.resolve(db);
    });

    return ready.promise;
}

module.exports = init;
module.exports.ready = ready.promise;
module.exports.connection = mongoose.connection;
@@ -177,16 +177,21 @@
 () %7B%0A   
+ db =
  mongoos
@@ -193,22 +193,31 @@
 ngoose.c
+reateC
 onnect
+ion
 (config.
@@ -233,38 +233,8 @@
 rl);
-%0A    db = mongoose.connection;
 %0A%0A  

Create a new mongoose connection