app-context-mongodb
MongoDB initializer for app-context
Usage
This initializer can be auto-installed by using it in your context file.
This initializer will attach the configured connections to APP.mongodb
.
module { this // attach a connection to APP.mongodb - use the value at APP.config.mongodb as the connection string // attach a connection to APP.mongodb // create 2 connections and attach them as an object to APP.mongodb // this will create APP.mongodb.users and APP.mongodb.data // you can also pass options to each connection // (from http://mongodb.github.io/node-mongodb-native/2.0/api/MongoClient.html#.connect) };
Connection Strings
Connection string formats and options are available in the mongodb driver docs.
Connection Configurations
Each connection can be configured with either a connection string (like mongodb://localhost/foobar
) or
with an object. The object will be passed through to MongoClient.connect
and can consist of any options
from the mongodb driver. There is a special url
option that this initializer requires.