<commit_before>/*jshint esversion:6 */

const mongoose = require('mongoose');
const mongoose_config = require('../../../mongoose_config');
mongoose.Promise = global.Promise;

// // fall- back
// mongoose.connect('mongodb://mongoose_config.user:mongoose_config.password@192.168.1.30/mongoose_config.database');
// var db = mongoose.connection;

var opts = { server: { auto_reconnect: false }, user: mongoose_config.user, pass: mongoose_config.password };
db = mongoose.createConnection(mongoose_config.host, mongoose_config.database, mongoose_config.port, opts);
// var opts = { server: { auto_reconnect: false }, user: 'username', pass: '<PASSWORD>' }
// db = mongoose.createConnection('localhost', 'database', port, opts)
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
    console.log("connected");
});

var kittySchema = mongoose.Schema({
    name: { type: String, required: true, index: { unique: true }, trim: true }
});

kittySchema.methods.meow = function () {
      var greeting = this.name ?
          "Meow name is " + this.name :
          "I don't have a name";
      console.log(greeting);
    };

var Kitten = db.model('Kitten', kittySchema);

module.exports.Kitten = Kitten;<commit_msg>use constructor to create Schema<commit_after>/*jshint esversion:6 */

const mongoose = require('mongoose');
const mongoose_config = require('../../../mongoose_config');
mongoose.Promise = global.Promise;

// // fall- back
// mongoose.connect('mongodb://mongoose_config.user:mongoose_config.password@192.168.1.30/mongoose_config.database');
// var db = mongoose.connection;

var opts = { server: { auto_reconnect: false }, user: mongoose_config.user, pass: mongoose_config.password };
db = mongoose.createConnection(mongoose_config.host, mongoose_config.database, mongoose_config.port, opts);
// var opts = { server: { auto_reconnect: false }, user: 'username', pass: '<PASSWORD>' }
// db = mongoose.createConnection('localhost', 'database', port, opts)
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
    console.log("connected");
});

var kittySchema = new mongoose.Schema({
    name: { type: String, required: true, index: { unique: true }, trim: true }
});

kittySchema.methods.meow = function () {
      var greeting = this.name ?
          "Meow name is " + this.name :
          "I don't have a name";
      console.log(greeting);
    };

var Kitten = db.model('Kitten', kittySchema);

module.exports.Kitten = Kitten;
{'fraction_non_alphanumeric': 0.16514489876935293, 'fraction_numerical': 0.007939658594680429, 'mean_word_length': 4.294117647058823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1549951', 'n_tokens_mistral': 798, 'n_tokens_neox': 818, 'n_words': 174}