{"size": 591, "ext": "js", "max_stars_repo_path": "config/database.js", "max_stars_repo_name": "vadymmarkov/reviewery-server", "max_stars_repo_stars_event_min_datetime": "2018-02-09T17:07:27.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-15T10:00:13.000Z", "max_issues_repo_path": "config/database.js", "max_issues_repo_name": "vadymmarkov/reviewery-server", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "config/database.js", "max_forks_repo_name": "vadymmarkov/reviewery-server", "max_forks_repo_forks_event_min_datetime": "2019-04-21T17:53:49.000Z", "max_forks_repo_forks_event_max_datetime": "2019-04-21T17:53:49.000Z"}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 21.8888888889, "max_line_length": 65, "alphanum_fraction": 0.6937394247}
'use strict';

// Dependencies
const mongoose = require('mongoose');

// Set the database name
const dbUrl = process.env['MONGODB_URI'];

// Connect to the database
mongoose.connect(dbUrl);

// Set Promise provider to bluebird
mongoose.Promise = require('bluebird');

// Get notified if the connection was successful or not
const db = mongoose.connection;

mongoose.plugin(schema => { schema.options.usePushEach = true });

db.once('open', () => {
  console.log(`Connected to the ${dbUrl} database`);
});

db.on('error', () => {
  console.log(`Connot connect to the ${dbUrl} database`);
});
