1.0.0 • Published 6 months ago

express-mongodb-db v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

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

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.

database

Type: String
Default: databaseOne

Serve to select which DATABASE is acceded by db

License

MIT © Vsevolod Strukchinsky

1.0.0

6 months ago