mongo-express-req

    3.0.2 • Public • Published

    mongo-express-req Build Status

    Get db connection in request

    Install

    $ npm install --save mongo-express-req
    

    Usage

    var app = require('express')();
    
    var expressMongoDb = require('mongo-express-req');
    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 and Dev Singh

    Install

    npm i mongo-express-req

    DownloadsWeekly Downloads

    1

    Version

    3.0.2

    License

    MIT

    Unpacked Size

    3.56 kB

    Total Files

    5

    Last publish

    Collaborators

    • dsingh2