jobscraper/lib/mongoManager.js
2020-10-07 11:53:17 +01:00

35 lines
742 B
JavaScript

/**
* Created by WebStorm.
* User: martin
* Date: 22/07/2020
* Time: 17:00
*/
const mongoose = require('mongoose');
const log4js = require('log4js');
const logger = log4js.getLogger();
const JobsModel = require('../models/jobs');
// const { Utils } = require('@rakh/utils');
require('dotenv').config();
logger.level = 'debug';
const mongoConnect = process.env.MONGOCONNECT;
// logger.debug(`mongodb://martin:1V3D4m526i@${ process.env.DBHOST }/${ process.env.DBNAME}`);
// mongoose.connect('mongodb://martin:1V3D4m526i@127.0.0.1/jobs');
logger.debug(mongoConnect);
mongoose.connect(mongoConnect);
const mDB = mongoose.connection;
mDB.on('error', console.error.bind(console, 'connection error:'));
module.exports = JobsModel;