<commit_before>const mongoose = require('./mongoose-shim');

module.exports = function(config, cb) {
  let mongodbUrl = config.db_uri;

  console.log('Connecting to MongoDB URL: %s\n', mongodbUrl);

  mongoose.connect(mongodbUrl, { useNewUrlParser: true }, function(error) {
    if (error) {
      console.log('Could not connect to DB: %s', error);
    }
    cb && cb(error);
  });

  mongoose.connection.on('error', function(error) {
    console.log('MongoDB connection error: %s', error);
  });

  return mongoose;
};
<commit_msg>fix: unified topology<commit_after>const mongoose = require('./mongoose-shim');

module.exports = function(config, cb) {
  let mongodbUrl = config.db_uri;

  console.log('Connecting to MongoDB URL: %s\n', mongodbUrl);

  mongoose.connect(
    mongodbUrl,
    { useNewUrlParser: true, useUnifiedTopology: true },
    function(error) {
      if (error) {
        console.log('Could not connect to DB: %s', error);
      }
      cb && cb(error);
    }
  );

  mongoose.connection.on('error', function(error) {
    console.log('MongoDB connection error: %s', error);
  });

  return mongoose;
};

{'fraction_non_alphanumeric': 0.15569395017793594, 'fraction_numerical': 0.0, 'mean_word_length': 3.6296296296296298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7110849', 'n_tokens_mistral': 389, 'n_tokens_neox': 380, 'n_words': 83}