MongoDB.getConnection()

Get an active connection to the database (in Mongo, this is currently a no-op).

Depending on what driver this is, and the config of the specified connection manager, `getConnection()` may involve opening a new connection, aquiring an already-open connection from an existing pool, or even just returning a mock connection (e.g. a dictionary containing host/port/credentials-- for connection-less database servers like ElasticSearch).

Usage

Hover over inputs/exits for more info.

var MongoDB = require('machinepack-mongo');


// Get an active connection to the database (in Mongo, this is currently a no-op).

MongoDB.getConnection({

manager: '===',

meta: '===',

}).execSync();

Inputs

manager required

A Mongo client instance (e.g. `db`).

'==='
meta

Additional stuff to pass to the driver.

'==='

Exits

error

An unexpected error occurred.

failed

Could not acquire a connection to the database via the provided connection manager. (WARNING: Currently, this is ignored by mp-mongo!)

{ error: '===', meta: '===' }
success

OK.

'==='