<commit_before>const log = require('winston')
const mongoose = require('mongoose')
const config = require('../config')
const moment = require('moment')
const debug = require('debug')('streamInfo:mongo')
mongoose.Promise = global.Promise

debug('Loading mongo.js')

// Check that we have a valid mongo uri
const mongoURI = new RegExp(
  '^(mongodb:(?:\\/{2})?)((\\w+?):(\\w+?)@|:?@?)(.*?):?(\\d+?)?\\/(.+?)\\/?$'
)
if (!config.mongoUri || !mongoURI.test(config.mongoUri)) {
  log.error('The config.mongoURI is not valid')
  return
} else {
  debug('Valid mongoURI')
  const dbName = config.mongoUri.match(mongoURI)[7]
  debug(`Attempting to connect to the mongoDB: '${dbName}'...`)

  // Make connection to the mongo db
  mongoose.connect(
    config.mongoUri,
    {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useFindAndModify: false,<commit_msg>mongo useCreateIndex<commit_after>const log = require('winston')
const mongoose = require('mongoose')
const config = require('../config')
const moment = require('moment')
const debug = require('debug')('streamInfo:mongo')
mongoose.Promise = global.Promise

debug('Loading mongo.js')

// Check that we have a valid mongo uri
const mongoURI = new RegExp(
  '^(mongodb:(?:\\/{2})?)((\\w+?):(\\w+?)@|:?@?)(.*?):?(\\d+?)?\\/(.+?)\\/?$'
)
if (!config.mongoUri || !mongoURI.test(config.mongoUri)) {
  log.error('The config.mongoURI is not valid')
  return
} else {
  debug('Valid mongoURI')
  const dbName = config.mongoUri.match(mongoURI)[7]
  debug(`Attempting to connect to the mongoDB: '${dbName}'...`)

  // Make connection to the mongo db
  mongoose.connect(
    config.mongoUri,
    {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useFindAndModify: false,
      useCreateIndex: true,
{'fraction_non_alphanumeric': 0.19289340101522842, 'fraction_numerical': 0.0022560631697687537, 'mean_word_length': 4.156976744186046, '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': '7166415', 'n_tokens_mistral': 635, 'n_tokens_neox': 630, 'n_words': 138}