2.1.0 • Published 8 years ago

steeplejack-mongodb v2.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Steeplejack MongoDB

Node.js Version Build Status Dependencies Dev Dependencies License

MongoDB implementation for steeplejack projects

Usage

This is a very thin wrapper for the MongoDB MongoClient.connect. It configures an instance of the MongoDB driver wrapped in generic-pool class for easy connection pooling.

This configures a Steeplejack injectable module called $mongodbDriver.

// Configure a factory dependency
export let __factory = {
    name: "$mongodbResource",
    factory: ($mongodbDriver) => {

        let poolOptions = {};
        let mongoOptions = {};
        let mongoUrl = "mongodb://localhost/db";

        return $mongodbDriver({
            url: mongoUrl,
            poolOptions,
            mongoOptions
        });

    }
};

The poolOptions accepts anything that the generic-pool takes.

The mongoOptions accepts anything that the MongoClient.connect options take.

Dependencies

This requires an object called StoreError to be registered to the Dependency Injector. You can either create your own or use the Steeplejack Errors package

2.1.0

8 years ago

2.0.0-1

8 years ago

2.0.0-0

8 years ago

1.0.0

8 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago