# mongodb-keyval-storage

> MongoDB token storage for Passport Magic Link

Latest version **1.0.0** (published 2019-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongodb-keyval-storage
pnpm add mongodb-keyval-storage
yarn add mongodb-keyval-storage
bun add mongodb-keyval-storage
```

## 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.0 |
| Published | 2019-04-23 |
| First published | 2019-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Vinicius Albano |
| Maintainers | vinialbano |
| Keywords | Authentication, MongoDB, Magic Link, Passport |

## Links

- npm: https://www.npmjs.com/package/mongodb-keyval-storage
- Repository: https://github.com/vinialbano/mongodb-keyval-storage
- Homepage: https://github.com/vinialbano/mongodb-keyval-storage#readme
- Issues: https://github.com/vinialbano/mongodb-keyval-storage/issues
- npm.io page: https://npm.io/package/mongodb-keyval-storage

## Dependencies (3)

- [mongodb](https://npm.io/package/mongodb.md) ^3.2.3
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.4.3
- [@babel/polyfill](https://npm.io/package/@babel/polyfill.md) ^7.4.3

## 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.0 (latest) — 2019-04-23

## README

# mongodb-keyval-storage
Key Value Storage for MongoDB with a simple API

[![Build Status](https://travis-ci.org/vinialbano/mongodb-keyval-storage.svg?branch=master)](https://travis-ci.org/vinialbano/mongodb-keyval-storage)
[![Coverage Status](https://coveralls.io/repos/github/vinialbano/mongodb-keyval-storage/badge.svg?branch=master)](https://coveralls.io/github/vinialbano/mongodb-keyval-storage?branch=master)

## Installation

  `npm install mongodb-keyval-storage`
  
## Usage

### Configure Strategy

  The MongoStorage constructor receives two parameters:

  * `db`: A MongoDB database connection or a connection string.
  * `collectionName`: The name of the collection used to save the data.
  
  ```javascript
    const storage = new MongoStorage({
      db: 'mongodb://localhost:27017/db',
      collectionName: 'myCollection'
    })
  ```
  
### API

#### Set
  Adds a value with it's respective key to the database. Returns a promise.
  
  ```javascript
  await storage.set('key', 'value')
  ```
  
#### Get
  Returns promise that resolves to a value given it's respective key.
  
  ```javascript
  const value = await storage.get('key')
  ```  
  
#### Delete
  Removes the key and value from the database, given the key. Returns a promise.
  
  ```javascript
  await storage.delete('key')
  ```

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