# mongo_keyval

> simple key-value store api on top of mongodb

Latest version **1.0.4** (published 2015-03-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongo_keyval
pnpm add mongo_keyval
yarn add mongo_keyval
bun add mongo_keyval
```

## 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.4 |
| Published | 2015-03-13 |
| First published | 2015-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Geza Kovacs |
| Maintainers | geza |

## Links

- npm: https://www.npmjs.com/package/mongo_keyval
- Repository: https://github.com/gkovacs/mongo_keyval
- Issues: https://github.com/gkovacs/mongo_keyval/issues
- npm.io page: https://npm.io/package/mongo_keyval

## Dependencies (1)

- [mongodb](https://npm.io/package/mongodb.md) ^1.4.34

## Recent versions

- 1.0.4 (latest) — 2015-03-13
- 1.0.3 — 2015-03-13
- 1.0.2 — 2015-03-12
- 1.0.1 — 2015-03-12
- 1.0.0 — 2015-03-12

## README

# mongo_keyval

simple key-value store api on top of mongodb

## Install

    npm install mongo_keyval

## Using

Setting a value. Value can be anything that is JSON-serializable: string, array, object

```javascript
var keyval = require('mongo_keyval')
keyval.set('somekey', 'someval')
keyval.set('otherkey', {some_object: 'yay json'})
```

Can optionally provide a callback to be called when setting is complete:

```javascript
keyval.set('somekey', 'someval', function(val) {
  console.log('finished setting somekey to ' + val)
})
```

Use get to get values:

```javascript
keyval.get('somekey', function(val) {
  console('value for somekey is ' + val)
})
```

## Mongo details

If using Heroku, your mongo url will automatically be used, from the following sources:

* process.env.MONGOHQ_URL
* process.env.MONGOLAB_URI
* process.env.MONGOSOUP_URL

Otherwise, the default url will be the local mongo instance:

* mongodb://localhost:27017/default

You can manually specify the mongo URL by setting mongo_keyval.mongourl

Values are stored in the collection 'vars' under the key specified.

You can manually specify the collection name by setting mongo_keyval.collection

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