emd

express-mongo-db

Get db connection in request object

Showing:

Popularity

Downloads/wk

2.3K

GitHub Stars

80

Maintenance

Last Commit

4yrs ago

Contributors

3

Package

Dependencies

1

Size (min+gzip)

108.7KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Express MongoDB

Readme

express-mongo-db Build Status

Get db connection in request

Install

$ npm install --save express-mongo-db

Usage

var app = require('express')();

var expressMongoDb = require('express-mongo-db');
app.use(expressMongoDb('mongodb://localhost/test'));

app.get('/', function (req, res, next) {
    req.db // => Db object
});

API

expressMongoDb(uri, [options])

uri

Required
Type: string

Connection string uri.

options

All options from MongoClient are accepted as well.

property

Type: String
Default: db

Property on request object in which db connection will be stored.

License

MIT © Vsevolod Strukchinsky

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Tutorials

No tutorials found
Add a tutorial