# binder-db

> Binder module for consistent database management across components

Latest version **1.0.1** (published 2016-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install binder-db
pnpm add binder-db
yarn add binder-db
bun add binder-db
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-04-21 |
| First published | 2016-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+7 in 1 direct dependencies) |
| Install scripts | yes |
| Author | Andrew Osheroff |
| Maintainers | andrewosh |
| Keywords | binder, database, db |

## Links

- npm: https://www.npmjs.com/package/binder-db
- Repository: https://github.com/binder-project/binder-db
- Issues: https://github.com/binder-project/binder-db/issues
- npm.io page: https://npm.io/package/binder-db

## Dependencies (1)

- [mongoose](https://npm.io/package/mongoose.md) ^4.4.2

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-04-21
- 1.0.0 — 2016-03-25

## README

# binder-db
Functions for consistent database access across from all Binder modules

All Binder modules expect to have access to a writable MongoDB instance. The `db` service provided by `binder-control`, started with `binder-control start-service db` will launch a Docker container with a preconfigured Mongo instance (and configurable properties in `binder-control`).

All configuration options are in `conf/main.json`.
```
andrew@binder-api:~/binder-db$ cat conf/main.json
{
  "host": "localhost",
  "port": 9050,
  "db": "binder"
}
```

### install
```
npm install binder-db
```
### api
##### getDatabase(cb)
Returns a Mongoose db wrapper that's connected to the main Binder database
 - `cb` function - callback(err, db)

### usage
```
var getDatabase = require('binder-db')
getDatabase(function (err, db) {
  // register models with the db, etc.
})
```

### examples
```
var getDatabase = require('binder-db')
getDatabase(function (err, db) {
  self.db = db
  self.buildInfo = db.model('Build', BuildInfoSchema)
  self.templates = db.model('Templates', registry.TemplateSchema)
})
```

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