macmongo
A basic helper for the mongodb native driver
installation
npm install macmongo
usage
var db = var logger = var config = host: "127.0.0.1" port: 27017 databases: exampledb: examplecollection: indexField:1 indexField:1 multipleFields1: 1 multipleFields2: -1 options: // See https://mongodb.github.io/node-mongodb-native/api-generated/server.html?highlight=server for options auto_reconnect: true poolSize: 2 db
APIs
var db = // Must be called first, with at least one database referenced in @paramsdb // Links a database (a.k.a makes the database available via db[dbname], or db.databases[dbname]), and creates it it doesn't already existsdb // Links a database (a.k.a makes the database available via db[dbname] if it already exists // Links a database (a.k.a makes the database available via db[dbname], or db.databases[dbname]), and creates it if necessary with all specified collections and indexesdb // Utility function to generate GUIDs, always useful when dealing with databases. Returns a stringdb // Gets the database layout in json format ({db1:[col1, col2], db2: [col3,etc..]}) - unlinked databases are not referenceddb