express-mongodb-db
v1.0.0
Published
connector to mongodb database directly to collection passed
Downloads
2
Readme
express-mongodb-db
Get db connection in request
Install
$ npm install --save express-mongodb-db
Usage
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
});
API
expressMongoDb(uri, [options])
uri
Required
Type: string
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.
database
Type: String
Default: databaseOne
Serve to select which DATABASE is acceded by db
License
MIT © Vsevolod Strukchinsky