0.0.6 • Published 6 years ago

@funcmaticjs/mongodb-plugin v0.0.6

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

mongodb-plugin

Funcmatic plugin that creates and manages a MongoDB connection

Install

$> npm install --save @funcmaticjs/mongodb-plugin

Use

const func = require('@funcmaticjs/funcmatic')
const MongoDBPlugin = require('@funcmaticjs/mongodb-plugin')
...
func.use(new MongoDBPlugin())

Environment

The following variables must exist in ctx.env during the env handler:

  • FUNC_MONGODB_URI: A MongoDB connection string.
  • FUNC_MONGODB_CACHE_CONNECTION (OPTIONAL): If it is set to the string 'false', then the plugin will establish and close a connection on every request.

Side Effects

  • ctx.state.mongodb: The MongoDB DB instance. Will NOOP if ctx.state.mongodb is already defined in ctx.state before this middleware runs. This property is useful if you want to mock ctx.state.mongodb.
0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago