mongoose-helpers-connection
returns a mongoose connection promise.
note: you can use mongoose-helpers-setup-db instead of using this module directly.
table of contents
notes
logging
- error events will be logged to the console
- additional logging - if
options.connection.debug
is set totrue
the following events will also be logged to the console- connected
- connecting
- disconnected
- open
- reconnected
errors
- if an error occurs, the error will be attached to the db object as
db.error
.
installation
npm install mongoose-helpers-connection
usage
var express = var connection = var mongoose = var app = var User = displayName: String email: String id: String photo: String var options = connection: debug: configdebug uri: database: configdatabase password: configpassword username: configusername schemas: 'User': User { return } // elsewhere in your appappdb