API Docs for: 0.8.0
Show:

DBManager Class

Wrapper that protects against direct access to the active connection pools and DB references.

Methods

authenticate

(
  • auth
  • db
  • cb
)

Parameters:

  • auth Object
  • db Db
  • cb Function

buildConnectionStr

(
  • config
)
String static

Parameters:

  • config Object
    • servers Array
    • name String

Returns:

String:

compareIndices

(
  • stored
  • defined
)
Boolean

Compares an index stored in Mongo to an index declared in pb.config

Parameters:

  • stored Object
  • defined Object

Returns:

Boolean:

dropUnconfiguredIndices

(
  • procedures
  • cb
)

Sorts through all created indices and drops any index not declared in pb.config

Parameters:

  • procedures Array
  • cb Function

ensureIndices

(
  • procedures
  • cb
)

Ensures all indices declared are defined on Mongo server

Parameters:

  • procedures Array
  • cb Function

getDb

(
  • name
)
Object

Retrieves a handle to the specified database.

Parameters:

  • name String

    The database name

Returns:

Object:

A promise object

getStoredInidices

(
  • cb
)

Yields all indices currently in the entire database

Parameters:

  • cb Function

hasConnected

(
  • name
)
Boolean

Indicates if a connection pool to the specified database has already been initialized

Parameters:

  • name String

Returns:

Boolean:

Whether the pool has been connected

isProtectedIndex

(
  • indexNamespace
)
Boolean static

Parameters:

  • indexNamespace String

Returns:

Boolean:

processIndices

(
  • procedures
  • cb
)

Takes an Array of indexing procedures and delegates them out to paralleled tasks.

Parameters:

  • procedures Array

    An array of objects that describe the index to place upon a collection. The object contains three properties. "collection" a string that represents the name of the collection to build an index for. "specs" is an object that describes which fields to index. The keys are the field names and the value is -1 for descending order and 1 for ascending. "options" is an object that that provides specific index properties such as unique or sparse. See http://mongodb.github.io/node-mongodb-native/api-generated/collection.html#ensureindex for specific MongoDB implementation details for specs and options.

  • cb Function

    A callback that provides two parameters: The first, an Error, if occurred. Secondly, an object that contains two properties. "result" an array of the results where each object in the array represents the result of the request to ensure the index. "errors" an array of errors that occurred while indexing. The function does not terminate after the first error. Instead it allows all indices to attempt to be created and defer the reporting of an error until the end.

shutdown

(
  • cb
)
Array

Iterates over all database handles and call's their shutdown function.

Parameters:

  • cb Function

    Callback function

Returns:

Array:

Array of promise objects, one for each shutdown call

Properties

CHUNKS_NAMESPACE

String private static

dbs

Object private

Keeps track of all active DBs with active connection pools.

FILES_NAMESPACE

String private static

PROTOCOL_PREFIX

Object private static

The protocol prefix for connecting to a mongo cluster

system

System private

Reference to the system instance of System

SYSTEM_NAMESPACE_PREFIX

String private static