Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mjlescano/mongoose-connection-ready
Promisified mongoose connection state.
https://github.com/mjlescano/mongoose-connection-ready
Last synced: 9 days ago
JSON representation
Promisified mongoose connection state.
- Host: GitHub
- URL: https://github.com/mjlescano/mongoose-connection-ready
- Owner: mjlescano
- License: mit
- Created: 2016-01-12T21:16:58.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-25T14:41:39.000Z (almost 8 years ago)
- Last Synced: 2024-10-13T13:23:11.023Z (24 days ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Mongoose Connection Ready
=========================Helper function to get a Promise from a Mongoose `connection` object.
Usage
=====```
npm install mongoose-connection-ready --save
``````javascript
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)
})
})
```