<commit_before>var MongoClient = require('mongodb');
    Q = require('q');

function initialize(callback) {
  var connect = Q.denodeify(MongoClient.connect);
  var dbInitialized = connect("mongodb://localhost:27017/codebrag");
  dbInitialized.then(ensureIndex);
  return dbInitialized.nodeify(callback);   // return promise, but allow for callback style too
}

function ensureIndex(db) {
  var indexFields = {
    instanceId: 1,
    date: 1
  };
  return Q.ninvoke(db.collection('statistics'), 'ensureIndex', indexFields, {unique:true});
}

module.exports = {
  initialize: initialize
};<commit_msg>Change stats server database name (from codebrag to codebrag_stats)<commit_after>var MongoClient = require('mongodb');
    Q = require('q');

function initialize(callback) {
  var connect = Q.denodeify(MongoClient.connect);
  var dbInitialized = connect("mongodb://localhost:27017/codebrag_stats");
  dbInitialized.then(ensureIndex);
  return dbInitialized.nodeify(callback);   // return promise, but allow for callback style too
}

function ensureIndex(db) {
  var indexFields = {
    instanceId: 1,
    date: 1
  };
  return Q.ninvoke(db.collection('statistics'), 'ensureIndex', indexFields, {unique:true});
}

module.exports = {
  initialize: initialize
};

{'fraction_non_alphanumeric': 0.13026211278792693, 'fraction_numerical': 0.011119936457505957, 'mean_word_length': 5.0576923076923075, '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': '775207', 'n_tokens_mistral': 392, 'n_tokens_neox': 380, 'n_words': 88}