# uebermongodb

> transform every database into a object key value store. This is a fork from Anh Nguyen to support MongoDB

Latest version **0.2.0** (published 2012-08-07) · 0 weekly downloads

## Install

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

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2012-08-07 |
| First published | 2012-08-07 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Peter 'Pita' Martischka |
| Maintainers | tot2ivn |
| Keywords | database, keyvalue |

## Links

- npm: https://www.npmjs.com/package/uebermongodb
- npm.io page: https://npm.io/package/uebermongodb

## Dependencies (4)

- [async](https://npm.io/package/async.md) 0.1.15
- [dirty](https://npm.io/package/dirty.md) 0.9.6
- [mysql](https://npm.io/package/mysql.md) 0.9.5
- [channels](https://npm.io/package/channels.md) 0.0.2

## Recent versions

- 0.2.0 (latest) — 2012-08-07

## README

#About

uebermongodb is a abstraction layer for databases. It turns every database into a simple key value store, at the moment we only support mysql and sqlite. uebermongodb uses a smart cache and buffer algorithm to make databases faster. Reads are cached and writes are done in a bulk. The bulk writing reduces the overhead of a database transaction.
uebermongodb is a fork from ueberDB by Peter 'Pita' Martischka <petermartischka@googlemail.com> with additional support for MongoDB.

#Install

`npm install uebermongodb`

#Example

<pre>
var uebermongodb = require("uebermongodb");

//mysql
var db = new uebermongodb.database("mysql", {"user":"root", host: "localhost", "password":"", database: "store"});
//sqlite in-memory
//var db = new uebermongodb.database("sqlite");
//sqlite in file
//var db = new uebermongodb.database("sqlite", {filename:"var/sqlite3.db"});
//sqlite in file with a write interval of a half second
//var db = new uebermongodb.database("sqlite", {filename:"var/sqlite3.db"}, {writeInterval: 500});

//initialize the database
db.init(function (err)
{
  if(err) 
  {
    console.error(err);
    process.exit(1);
  }

  //set a object as a value
  //can be done without a callback, cause the value is immediately in the buffer
  db.set("valueA", {a:1,b:2});
  
  //get the object
  db.get("valueA", function(err, value){
    console.log(value);
    
    db.close(function(){
      process.exit(0);
    });
  });
});
</pre>

#How to add support for another database
Look at sqlite_db.js and mysql_db.js, your module have to provide the same functions. Call it DATABASENAME_db.js and reimplement the functions for your database. If you think it works, test it with `node benchmark.js DATABASENAME`. Benchmark.js is benchmark and test at the same time. It tries to set 100000 values. You can pipe stderr to a file and will create a csv with benchmark results.

#License 
is Apache v2

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