Ninja Pumpkin Mutants

    mongoose-connection-ready

    1.0.1 • Public • Published

    Mongoose Connection Ready

    Helper function to get a Promise from a Mongoose connection object.

    Usage

    npm install mongoose-connection-ready --save
    
    var mongoose = require('mongoose')
    var connReady = require('mongoose-connection-ready')
     
    mongoose.connect('mongodb://localhost/dev')
     
    connReady(mongoose.connection)
      .then(function () {
        console.log('Mongo connected successfully!')
      })
      .catch(function () {
        console.error('Couldn\'t connect to Mongo.')
        mongoose.connection.close(function () {
          process.exit(1)
        })
      })

    Install

    npm i mongoose-connection-ready

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • mjlescano