1.0.0 • Published 9 years ago

mongo-factory v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

#mongo-factory Build Status Code Climate

The purpose of this module is to manage mongo connection pools without creating a new connection pool in every file.

You can require this module in as many files as you want and every time you call mongoFactory.getConnection it returns a connection if one exists for the connection string passed in, or it instantiates the connection pool and then returns a connection.

Usage

var mongoFactory = require('mongo-factory');

mongoFactory.getConnection('mongodb://localhost:27017')
  .then(function(db) {
    // Use mongo's "db" object as you normally would.
    db.collection.find()...
  })
  .catch(function(err) {
    console.error(err);
  });

API

getConnection(mongodbConnectionString)

The only parameter is a connection string for a MongoDB connection.

ObjectId

Exposes the MongoDB ObjectID function.

Contributing

  1. Clone project and run npm install
  2. Add feature(s)
  3. Add tests for it
  4. Submit pull request

Enjoy!

1.0.0

9 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.0.6

10 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago

0.0.0

11 years ago