Skip to content

Simple module to connect to Mongo in RHMAP and return a mongoose connection

License

Notifications You must be signed in to change notification settings

col1985/fh-mongoose-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fh-mongoose-connector

Build Status

Connector module for FeedHenry/RHMAP retuns a Mongoose database connection object that canbe consumed by Mongoose Schema's and Models.

how to use

require

  var connector = require('fh-mongoose-connector');

connect

  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
  });

getConfig

  connecter.getConfig(function(cfg) {
    // do stuff
    console.log(cfg)
  });

disconnect

  connecter.closeConnection();

Test

To Run tests, clone repo, ensure MongoDB is running locally or start mongo by running mongod. And enter the following command.

  npm test

About

Simple module to connect to Mongo in RHMAP and return a mongoose connection

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published