jobscraper/lib/mongoManager.js

35 lines
739 B
JavaScript
Raw Normal View History

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