# modreal-mongoose-connection

> This is an opinionated simple mongoose connection package. It assumes:

Latest version **0.0.3** (published 2013-11-10) · 0 weekly downloads

## Install

```sh
npm install modreal-mongoose-connection
pnpm add modreal-mongoose-connection
yarn add modreal-mongoose-connection
bun add modreal-mongoose-connection
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2013-11-10 |
| First published | 2013-11-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+8 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | aj0strow |

## Links

- npm: https://www.npmjs.com/package/modreal-mongoose-connection
- Repository: https://github.com/modreal/mongoose-connection
- Issues: https://github.com/modreal/mongoose-connection/issues
- npm.io page: https://npm.io/package/modreal-mongoose-connection

## Dependencies (3)

- [mongoose](https://npm.io/package/mongoose.md) ~3.8.0
- [modreal-config](https://npm.io/package/modreal-config.md) ~0.0.3
- [modreal-logger](https://npm.io/package/modreal-logger.md) ~0.0.2

## Recent versions

- 0.0.3 (latest) — 2013-11-10
- 0.0.2 — 2013-11-09
- 0.0.1 — 2013-11-06

## README

# modreal-mongoose-connection

This is an opinionated simple mongoose connection package. It assumes:

- you're using `modreal/config` and have a `config/mongo.json` with db urls
- you're using `modreal/logger` for logging with loggly

It handles closing the connection when the script is killed, and giving error messages when it can't connect. 

### How To Use

Create a `config/mongo.json` file, and add to it something like:

```json
{
  "development": "mongodb://localhost:27017/dev_db",
  "test": "mongodb://localhost:27017/test_db"
}
```

Then install mongoose-connection:

```
$ npm install modreal/mongoose-connection --save
```

Require it, and add your callback to the connection:

```javascript
// javascript

var connection = require("modreal-mongoose-connection");
connection.on("connected", function() {
  // start app
});
```

```coffeescript
# coffeescript

connection = require 'modreal-mongoose-connection'
connection.on 'connected', ->
  # start app
```

The package checks for a global mongoose library as well. 

```
global.mongoose = require('mongoose')

// later

connection.mongoose == global.mongoose
```

### License

MIT

---

AJ Ostrow, November 2013

---
_Source: https://npm.io/package/modreal-mongoose-connection · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
