# redm

> NodeJS ODM for NoSQL, Couchbase, Redis

Latest version **0.1.0** (published 2014-12-15) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-12-15 |
| First published | 2014-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ioan CHIRIAC |
| Maintainers | ichiriac |
| Keywords | redis, odm, crud |

## Links

- npm: https://www.npmjs.com/package/redm
- Repository: https://github.com/ichiriac/redm
- Homepage: http://ichiriac.github.io/sofa-odm
- Issues: https://github.com/ichiriac/redm/issues
- npm.io page: https://npm.io/package/redm

## Dependencies (2)

- [nodm](https://npm.io/package/nodm.md) ^0.1.10
- [redis](https://npm.io/package/redis.md) ^0.12.1

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-12-15

## README

# REDM the Redis ODM

This project is a driver for the [NodeJS NoSQL ODM](https://github.com/ichiriac/node-nosql-odm/), visit this repository for further informations.

*Current version: [v/0.1.0][dist]*

[![Build Status](https://travis-ci.org/ichiriac/redm.svg)](https://travis-ci.org/ichiriac/sofa-odm)
[![Dependency Status](https://david-dm.org/ichiriac/redm.svg)](https://david-dm.org/ichiriac/sofa-odm)
[![Coverage Status](https://coveralls.io/repos/ichiriac/redm/badge.png?branch=master)](https://coveralls.io/r/ichiriac/redm)

## Getting started

```sh
npm install redm --save
```

## Sample code

```js
var sofa = require('redm');
var session = new redm();
// handles all errors
session.on('error', function(err) {
  console.error(err);
});
// declare a user mapper attached to current session
var users = session.declare('user', {
  // declare properties
  properties: {
    name: {
      type: 'string',       // data type : string, number, boolean, array, object
      validate: [4, 64]     // validators, depends on data type
    },
    email: {
      type: 'string',
      validate: /S+@S+\.S+/,
      unique: true
    },
    password: {
      type: 'string',
      validate: [6, 24]
    }
  }
});
// connect to couchbase
session.connect({
  // connection parameters
  host: 'localhost:8091',
  database: 1
}).then(function() {
  // creates a new entry
  var john = users.create({
    name: 'John Doe',
    email: 'john@doe.com',
    password: 'secret'
  });
  // saves the active record
  john.save()
    // use a email view to find the user
    .then(function() {
      return users.find('email', 'john@doe.com');
    })
    // deletes the first found record
    .then(function(result) {
      return result.rows[0].remove();
    })
    .done()
  ;
}).done();
```

#Misc

This code is distribute under The MIT License (MIT), authored by Ioan CHIRIAC.

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