# services-db-mixin

> Moleculer mixin to provide a mongodb interface for microservices

Latest version **2.3.2** (published 2020-01-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install services-db-mixin
pnpm add services-db-mixin
yarn add services-db-mixin
bun add services-db-mixin
```

## 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 | 2.3.2 |
| Published | 2020-01-03 |
| First published | 2019-09-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Joaquín Gumucio |
| Maintainers | jjgumucio |
| Keywords | mixin, mongodb, moleculer, microservices, rancagua-digital |

## Links

- npm: https://www.npmjs.com/package/services-db-mixin
- Repository: https://github.com/RancaguaInnova/services-db-mixin
- Homepage: https://github.com/RancaguaInnova/services-db-mixin#readme
- Issues: https://github.com/RancaguaInnova/services-db-mixin/issues
- npm.io page: https://npm.io/package/services-db-mixin

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [moleculer-db](https://npm.io/package/moleculer-db.md) ^0.8.2
- [moleculer-db-adapter-mongo](https://npm.io/package/moleculer-db-adapter-mongo.md) ^0.4.5

## 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

- 2.3.2 (latest) — 2020-01-03
- 2.3.1 — 2020-01-03
- 2.2.9 — 2020-01-03
- 2.3.0 — 2020-01-03
- 2.2.8 — 2019-11-25
- 2.1.8 — 2019-10-07
- 2.0.8 — 2019-09-23
- 2.0.7 — 2019-09-23
- 2.0.6 — 2019-09-23
- 2.0.5 — 2019-09-23
- 2.0.4 — 2019-09-09
- 2.0.3 — 2019-09-09
- 2.0.2 — 2019-09-09
- 2.0.0 — 2019-09-09
- 1.0.0 — 2019-09-09

## README

# Rancagua Digital Moleculer DB Mixin

## Description

Moleculer Mixin to provide a _MongoDB_ database interface to _[Moleculer](https://moleculer.services)_ microservices.

## Installation

`npm install services-db-mixin`
or
`yarn add services-db-mixin`

## Usage

When defining your _[Moleculer](https://moleculer.services)_ service add the _DBService_ as a mixin:

```javascript
const DBService = require('services-db-mixin')

module.exports = {
  name: '<service-name>',
  version: 1,

  mixins: [
    DbService(
      '<bd-url> or an empty string to use MONGO_URI env var',
      '<collection-name>',
      { version: 1, name: '<logging-service-name>', action: '<service-action-to-call>' }),
  ],
  ...
}
```

**NOTE:** 
If you don't pass a database url or don't set the MONGODB_URI env var, This package will use _moleculer-db MemoryAdapter_.
This is usefull for running tests without hitting the database.

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