DBManager Class
Wrapper that protects against direct access to the active connection pools and DB references.
Item Index
Methods
Properties
- CHUNKS_NAMESPACE static
- dbs
- FILES_NAMESPACE static
- PROTOCOL_PREFIX static
- system
- SYSTEM_NAMESPACE_PREFIX static
Methods
authenticate
-
auth
-
db
-
cb
Parameters:
-
auth
Object -
db
Db -
cb
Function
buildConnectionStr
-
config
Parameters:
-
config
Object-
servers
Array -
name
String
-
Returns:
compareIndices
-
stored
-
defined
Compares an index stored in Mongo to an index declared in pb.config
Parameters:
-
stored
Object -
defined
Object
Returns:
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
Retrieves a handle to the specified database.
Parameters:
-
name
StringThe database name
Returns:
A promise object
getStoredInidices
-
cb
Yields all indices currently in the entire database
Parameters:
-
cb
Function
hasConnected
-
name
Indicates if a connection pool to the specified database has already been initialized
Parameters:
-
name
String
Returns:
Whether the pool has been connected
isProtectedIndex
-
indexNamespace
Parameters:
-
indexNamespace
String
Returns:
processIndices
-
procedures
-
cb
Takes an Array of indexing procedures and delegates them out to paralleled tasks.
Parameters:
-
procedures
ArrayAn 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
FunctionA 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
Iterates over all database handles and call's their shutdown function.
Parameters:
-
cb
FunctionCallback function
Returns:
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