<commit_before>'use strict';

var mongoose = require('mongoose');

exports.connectDB = () => {
	console.log(process.env.MANHATTANDB);
	mongoose.connect(process.env.MANHATTANDB);
	console.log("state: ", mongoose.connection.readyState);
	console.log("Mongo Connected");
}
exports.disconnectDB = () => {
	mongoose.disconnect();
	console.log("state: ", mongoose.connection.readyState);
	console.log("Mongo Diconnected");
}<commit_msg>implemented check for the connection state before creating a new connection<commit_after>'use strict';

var mongoose = require('mongoose');

exports.connectDB = () => {
	console.log(process.env.MANHATTANDB);
	console.log("before state: ", mongoose.connection.readyState);
	if (mongoose.connection.readyState != 2) {
		mongoose.connect("mongodb://127.0.0.1:27017/niteowl");
		console.log("after state: ", mongoose.connection.readyState);
		console.log("Mongo Connected");
	} else {
		console.log("Mongo Already Connected");
	}
}
exports.disconnectDB = () => {
	mongoose.disconnect();
	console.log("state: ", mongoose.connection.readyState);
	console.log("Mongo Diconnected");
}
{'fraction_non_alphanumeric': 0.16817359855334538, 'fraction_numerical': 0.0108499095840868, 'mean_word_length': 5.962264150943396, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '1151812', 'n_tokens_mistral': 377, 'n_tokens_neox': 376, 'n_words': 57}