Connector module for FeedHenry/RHMAP retuns a Mongoose database connection object that canbe consumed by Mongoose Schema's and Models.
var connector = require('fh-mongoose-connector');
var uri = process.env.FH_MONGO_CONN_URL || 'mongodb://loclahost:27017/FH_LOCAL';
var opts = {
keepAlive: true,
poolSize: 10,
connectTimeoutMS: 60000,
promiseLibrary: require('bluebiard') // can be any promise lib
};
connecter.connectToMongo(uri, opts, function(err, db) {
// do stuff
});
connecter.getConfig(function(cfg) {
// do stuff
console.log(cfg)
});
connecter.closeConnection();
To Run tests, clone repo, ensure MongoDB is running locally or start mongo by running mongod
. And enter the following command.
npm test