<commit_before>console.warn('Do not use this for production database!');

let mongoose = require('mongoose');

let User = require('../src/models/user').model;
let config = require('../src/config');

// Overriding the deprecated "Promise" module of mongoose.
// For more information see: https://github.com/Automattic/mongoose/issues/4291
mongoose.Promise = global.Promise;
mongoose.connect(config.database);

let admin = new User({
    firstName: 'admin',
    lastName: 'askaround',
    email: '<EMAIL>',
    password: '<PASSWORD>',
    isAdmin: true,
    isActive: true,
});
admin.save();

console.log('===================================');
console.log('            Seed complete          ');
console.log('===================================');<commit_msg>The seed file only adds an admin if there isn't one already.<commit_after>console.warn('Do not use this for production database!');

let mongoose = require('mongoose');

let User = require('../src/models/user').model;
let config = require('../src/config');

// Overriding the deprecated "Promise" module of mongoose.
// For more information see: https://github.com/Automattic/mongoose/issues/4291
mongoose.Promise = global.Promise;
mongoose.connect(config.database, { useMongoClient: true, keepAlive: false });


User.find({ email: '<EMAIL>' }).exec().then((data) => {
    if (!data || !data.length) {
        let admin = new User({
            firstName: 'admin',
            lastName: 'askaround',
            email: '<EMAIL>',
            password: '<PASSWORD>',
            isAdmin: true,
            isActive: true,
        });
        admin.save();
    }
    process.exit(0);
});

console.log('===================================');
console.log('            Seed complete          ');
console.log('===================================');
{'fraction_non_alphanumeric': 0.23, 'fraction_numerical': 0.005, 'mean_word_length': 3.4469135802469135, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '763765', 'n_tokens_mistral': 507, 'n_tokens_neox': 508, 'n_words': 128}