{"size": 527, "ext": "js", "max_stars_repo_path": "loaders/mongoose.js", "max_stars_repo_name": "Luisetelo/stacktelo", "max_stars_repo_stars_event_min_datetime": "2020-05-26T09:08:58.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-02T07:01:13.000Z", "max_issues_repo_path": "loaders/mongoose.js", "max_issues_repo_name": "Luisetelo/stacktelo", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "loaders/mongoose.js", "max_forks_repo_name": "Luisetelo/stacktelo", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.0, "max_line_length": 70, "alphanum_fraction": 0.6831119545}
const mongoose = require('mongoose');
const { mongodbUri } = require('../config');

module.exports = async () => {
  // To debug a connection error but it is shown in the console anyway
  // mongoose.connection.on('error', (error) => {
  //   console.error('Mongoose connection error:', error);
  // });
  const mongooseInstance = await mongoose.connect(mongodbUri, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useFindAndModify: false,
    useCreateIndex: true,
  });
  return mongooseInstance.connection;
};
