<commit_before>
var mongoose = require('mongoose');
var db;
var cfenv = require('cfenv');
var appenv = cfenv.getAppEnv();

if (process.env.VCAP_SERVICES) { 

var mongoDbUrl, mongoDbOptions = {};
var mongodb_services = services["compose-for-mongodb"];

var credentials = mongodb_services[0].credentials;

var ca = [new Buffer(credentials.ca_certificate_base64, 'base64')];
mongoDbUrl = credentials.uri;
mongoDbOptions = {
  mongos: {
    ssl: true,
    sslValidate: true,
    sslCA: ca,
    poolSize: 1,
    reconnectTries: 1
  }
};
console.log("Connecting to", mongoDbUrl);
db= mongoose.connect(mongoDbUrl, mongoDbOptions);
} else {
   db = mongoose.createConnection('localhost', 'ikeasocialapp');
}

exports.db = db;<commit_msg>Update dbservice.js<commit_after>
var mongoose = require('mongoose');
var db;
var cfenv = require('cfenv');
var appenv = cfenv.getAppEnv();

var services = appEnv.services;

if (process.env.VCAP_SERVICES) { 

var mongoDbUrl, mongoDbOptions = {};
var mongodb_services = services["compose-for-mongodb"];

var credentials = mongodb_services[0].credentials;

var ca = [new Buffer(credentials.ca_certificate_base64, 'base64')];
mongoDbUrl = credentials.uri;
mongoDbOptions = {
  mongos: {
    ssl: true,
    sslValidate: true,
    sslCA: ca,
    poolSize: 1,
    reconnectTries: 1
  }
};
console.log("Connecting to", mongoDbUrl);
db= mongoose.connect(mongoDbUrl, mongoDbOptions);
} else {
   db = mongoose.createConnection('localhost', 'ikeasocialapp');
}

exports.db = db;
{'fraction_non_alphanumeric': 0.13894455577822312, 'fraction_numerical': 0.009352037408149633, 'mean_word_length': 5.114285714285714, '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': '5174506', 'n_tokens_mistral': 553, 'n_tokens_neox': 537, 'n_words': 111}