# happn-db-provider-mongo

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

Latest version **1.1.13** (published 2024-07-17) · 0 weekly downloads

## Install

```sh
npm install happn-db-provider-mongo
pnpm add happn-db-provider-mongo
yarn add happn-db-provider-mongo
bun add happn-db-provider-mongo
```

## 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.1.13 |
| Published | 2024-07-17 |
| First published | 2022-03-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 21.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | smc-tenacious, erasmusjw, simonbishopza |
| Keywords | mongo, happn |

## Links

- npm: https://www.npmjs.com/package/happn-db-provider-mongo
- 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-db-provider-mongo

## Dependencies (3)

- [mongodb](https://npm.io/package/mongodb.md) ^4.11.0
- [happn-commons](https://npm.io/package/happn-commons.md) 1.5.1
- [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

- 1.1.13 (latest) — 2024-07-17
- 1.1.13-prerelease-2 (prerelease-1) — 2024-05-14
- 1.1.13-prerelease-1 — 2024-05-10
- 1.1.12 — 2024-04-02
- 1.1.12-prerelease-4 — 2023-12-21
- 1.1.12-prerelease-3 — 2023-09-14
- 1.1.12-prerelease-2 — 2023-09-13
- 1.1.12-prerelease-1 — 2023-08-30
- 1.1.11 — 2023-08-06
- 1.1.10 — 2023-05-24
- 1.1.9 — 2023-05-02
- 1.1.9-prerelease-1 — 2023-03-04
- 1.1.8 — 2023-03-03
- 1.1.7 — 2023-02-17
- 1.1.6 — 2023-02-06
- … 52 more at https://npm.io/package/happn-db-provider-mongo/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-db-provider-mongo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
