1.3.0 • Published 3 years ago

mongodb-express-req v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Get db connection in request

Install

$ npm install mongodb-express-req

Usage

var app = require('express')();

var expressMongoDb = require('mongodb-express-req');
app.use(expressMongoDb('mongodb://localhost/db_name'));

app.get('/', function (req, res, next) {
  req.db // => Db object
  req.db.collection('collection_name').insertOne({ email, password })
});

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.

Credentials

Fork of titanscouting/mongo-express-req

License

MIT © Roman Shmigelsky

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago