Get db connection in request
$ npm install --save express-mongo-db
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
});
Required
Type: string
All options from MongoClient are accepted as well.
Type: String
Default: db
Property on request
object in which db connection will be stored.
MIT © Vsevolod Strukchinsky