# happn-service-mongo-2

> service plugin for running happn on a mongo database, for happn-3 instances

Latest version **4.0.1** (published 2021-10-15) · 0 weekly downloads

## Install

```sh
npm install happn-service-mongo-2
pnpm add happn-service-mongo-2
yarn add happn-service-mongo-2
bun add happn-service-mongo-2
```

## 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 | 4.0.1 |
| Published | 2021-10-15 |
| First published | 2016-11-08 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 649.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | jeggers, smc-tenacious |
| Keywords | mongo, happn |

## Links

- npm: https://www.npmjs.com/package/happn-service-mongo-2
- Repository: https://github.com/happner/happn-service-mongo-2
- Homepage: https://github.com/happner/happn-service-mongo-2#readme
- Issues: https://github.com/happner/happn-service-mongo-2/issues
- npm.io page: https://npm.io/package/happn-service-mongo-2

## Dependencies (2)

- [mongodb](https://npm.io/package/mongodb.md) ^4.1.3
- [parse-mongo-url](https://npm.io/package/parse-mongo-url.md) ^1.1.1

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

- 4.0.1 (latest) — 2021-10-15
- 5.0.0-prerelease-1 (prerelease-5) — 2021-11-07
- 4.0.0-prerelease-1 (prerelease-4) — 2021-10-06
- 3.2.0-prerelease-mongo4 (prerelease-mongo4) — 2021-08-26
- 2.0.0-alpha.3 (prerelease) — 2018-01-26
- 4.0.0 — 2021-10-07
- 3.1.2 — 2021-07-20
- 3.1.1 — 2021-07-17
- 3.1.0 — 2021-02-15
- 3.0.0 — 2019-10-14
- 2.2.0 — 2019-05-24
- 2.1.1 — 2018-05-29
- 2.1.0 — 2018-05-14
- 2.0.0 — 2018-04-05
- 2.0.0-alpha.2 — 2018-01-26
- … 8 more at https://npm.io/package/happn-service-mongo-2/versions

## README

[![npm](https://img.shields.io/npm/v/happn-service-mongo-2.svg)](https://www.npmjs.com/package/happn-service-mongo-2) [![Build Status](https://travis-ci.org/happner/happn-service-mongo-2.svg?branch=master)](https://travis-ci.org/happner/happn-service-mongo-2) [![Coverage Status](https://coveralls.io/repos/happner/happn-service-mongo-2/badge.svg?branch=master&service=github)](https://coveralls.io/github/happner/happn-service-mongo-2?branch=master) [![David](https://img.shields.io/david/happner/happn-service-mongo-2.svg)]()

<img src="https://raw.githubusercontent.com/happner/happner-website/master/images/HAPPN%20Logo%20B.png" width="300"></img>

Introduction
-------------------------

### installing mongo and redis on your local machine - for testing:
```bash
# mongo latest
docker pull mongo

docker run -p 27017:27017 -d mongo

# redis
docker pull redis

docker run -p 6379:6379 -d redis
```

### Two configuration options:

```javascript
config = {
  // name of collection where happn/happner stores data
  collection: 'collectioName',
  
  // database housing the collection
  url: 'mongodb://127.0.0.1:27017/databaseName'
}
```


Getting started
---------------------------

### Using this plugin from happner.

```bash
npm install happner happn-service-mongo --save
```

See [happner](https://github.com/happner/happner-2) for full complement of config.

```javascript
var Happner = require('happner');

var config = {
  happn: {
    plugin: 'happn-service-mongo',
    config: {
      collection: 'happner',
      url: 'mongodb://127.0.0.1:27017/happner'
    }
  }
};

Happner.create(config)

  .then(function(server) {
    // ...
  })

  .catch(function(error) {
    console.error(error.stack);
    process.exit(1);
  });
```

### Using this plugin from happn.

```bash
npm install happn happn-service-mongo --save
```

See [happn](https://github.com/happner/happn-3) for full complement of config.

```javascript
var Happn = require('happn');

var config = {
  services: {
    data: {
      path: 'happn-service-mongo',
      config: {
        collection: 'happn',
        url: 'mongodb://127.0.0.1:27017/happn'
      }
    }
  }
};

Happn.service.create(config)

  .then(function(server) {
    //...
  })

  .catch(function(error) {
    console.error(error.stack);
    process.exit(1);
  });

```

##release 0.1.0

 - ability to partition db's and collections by path
 - allow for update or findAndModify depending on options
 - embedded LRU cache, that can use redis pubsub to share state around

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