// Init mongoose connection


'use strict';


var mongoose = require('mongoose');


////////////////////////////////////////////////////////////////////////////////


module.exports = function (N) {

  N.wire.before('init:models', function mongoose_init(N) {
    var config = (N.config.database || {}).mongo;

    if (!config) throw 'No MongoDB configuration found';

    N.logger.info('Connecting to MongoDB');

    var options = {
      server  : {
        socketOptions: { keepAlive: 1 }
      },
      replset : {
        socketOptions: { keepAlive: 1 }
      }
    };

    return mongoose.connect(config, options)
      .then(function () {
        N.logger.info('MongoDB connected');
      });
  });
};

@@ -39,19 +39,21 @@
 ict';%0A%0A%0A
-var
+const
  mongoos
@@ -77,16 +77,84 @@
 oose');%0A
+const bluebird = require('bluebird');%0A%0A%0Amongoose.Promise = bluebird;
 %0A%0A//////
@@ -506,16 +506,57 @@
     
+promiseLibrary: require('bluebird'),%0A      
 server
-  
 : %7B%0A
@@ -617,17 +617,16 @@
  replset
- 
 : %7B%0A    

Use bluebird in mongoose