text: const config = require('../configs');
  const log = require('./log');
  const mongoose = require('mongoose');
  
  mongoose.connect(config.MONGODB_URI);
  
  // Get Mongoose to use the global promise library
  mongoose.Promise = global.Promise;
  
  //Get the default connection
  const db = mongoose.connection;
  
  // Console log events
  db.on('connecting', function () {
      console.log('connecting to MongoDB...');
  });
  db.on('error', function (error) {
      console.error('Error in MongoDb connection: ' + error);
  });
  db.on('connected', function () {
      console.log('MongoDB connected!');
  });
  db.once('open', function () {
      console.log('MongoDB connection opened!');
  });
  db.on('reconnected', function () {
      console.log('MongoDB reconnected!');
  });
  db.on('disconnected', function () {
      console.log('MongoDB disconnected!');
  });