Get db connection in request
$ npm install --save express-mongodb-db
var app = require('express')();
var expressMongoDb = require('express-mongodb-db');
app.use(expressMongoDb('mongodb://localhost/test', {database: 'databaseOne'}));
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.
Type: String
Default: databaseOne
Serve to select which DATABASE is acceded by db
MIT © Vsevolod Strukchinsky