<commit_before>module.exports = function() {
  'use strict';

  DependencyInjection.service('$MongoService', [function() {

    var mongoose = require('mongoose');

    return new (function MongoService() {

      var _connections = [];

      this.connections = function() {
        return _connections;
      };

      this.defaultConnection = function() {
        if (_connections && _connections.length) {
          return _connections[0];
        }

        return null;
      };

      this.create = function(host, database, user, password, poolSize) {
        // MongDB max connections: 20 - Mongoose monitor 1 = 19
        poolSize = poolSize || 19;

        mongoose.connect(
          'mongodb://' + (user ? user + ':' + password + '@' : '') + host + '/' + database, {
            server: {
              socketOptions: {
                keepAlive: 1
              },
              poolSize: poolSize
            }
          }
        );

        _connections.push(mongoose);

        return mongoose;
      };

    })();

  }]);

};<commit_msg>refactor(common mongo service): remove useless defaultConnection() method<commit_after>module.exports = function() {
  'use strict';

  DependencyInjection.service('$MongoService', [function() {

    var mongoose = require('mongoose');

    return new (function MongoService() {

      var _connections = [];

      this.connections = function() {
        return _connections;
      };

      this.create = function(host, database, user, password, poolSize) {
        // MongDB max connections: 20 - Mongoose monitor 1 = 19
        poolSize = poolSize || 19;

        mongoose.connect(
          'mongodb://' + (user ? user + ':' + password + '@' : '') + host + '/' + database, {
            server: {
              socketOptions: {
                keepAlive: 1
              },
              poolSize: poolSize
            }
          }
        );

        _connections.push(mongoose);

        return mongoose;
      };

    })();

  }]);

};
{'fraction_non_alphanumeric': 0.13356678339169584, 'fraction_numerical': 0.008504252126063032, 'mean_word_length': 1.7932960893854748, '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': '4662881', 'n_tokens_mistral': 586, 'n_tokens_neox': 534, 'n_words': 119}