# node-dynamodb

> A (work-in-progress) Mongoose-like API for DynamoDB

Latest version **0.0.3** (published 2017-02-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-dynamodb
pnpm add node-dynamodb
yarn add node-dynamodb
bun add node-dynamodb
```

## 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.0.3 |
| Published | 2017-02-26 |
| First published | 2017-02-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+11 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | danamajid |

## Links

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

## Dependencies (2)

- [async](https://npm.io/package/async.md) 2.1.5
- [lodash](https://npm.io/package/lodash.md) 4.17.4

## Recent versions

- 0.0.3 (latest) — 2017-02-26
- 0.0.2 — 2017-02-26

## README

## node-dynamodb [![CircleCI](https://circleci.com/gh/danamajid/node-dynamodb.svg?style=svg&circle-token=ecce8b4678b87c308c3914f63ea9d21cddd27f9a)](https://circleci.com/gh/danamajid/node-dynamodb)

A (work-in-progress) Mongoose-like API for DynamoDB

### DynamoDB

__Example:__

```js
var DynamoDB = require('node-dynamodb');
```

### Methods

#### DynamoDB.model(schema, options)

Define your model.

__Example:__

```js
var Movie = DynamoDB.model('Movies', new DynamoDB.Schema({
  year: {
    type: DynamoDB.types.Number,
    index: DynamoDB.types.Hash
  },
  title: {
    type: DynamoDB.types.String,
    index: DynamoDB.types.Range
  }
}, {
  readCapacity: 10,
  writeCapacity: 20
}));
```


#### DynamoDB.connect(options, callback);

Connect, and sync your defined models.

* `env` - The environment
* `database` - The environment
* `connection` - Object with an instance of `new AWS.DynamoDB` for `db` and `new AWS.DynamoDB.DocumentClient` for `client`
* `logger` - Optional interface that implements `info`, `warn`, `error`, `fatal`, `debug`, `trace` and `child`.

__Example:__

```js
DynamoDB.connect({
  env: 'dev',
  database: 'biem',
  connection: {
    db: new AWS.DynamoDB({
      endpoint: new AWS.Endpoint('http://localhost:4337')
    }),
    client: new AWS.DynamoDB.DocumentClient({
      endpoint: new AWS.Endpoint('http://localhost:4337')
    })
  }
}, function(err, data) {
  console.log(data);
  /*
  {
    sync: {
      none: [],
      created: ['Movies'],
      updated: []
    }
  }
  */
});
```


#### Movie.put(details, callback);

Put an item.

__Example:__

```js
Movie.put({
  year: 2001,
  title: 'A Beautiful Mind'
}, done);
```

#### Movie.get(details, callback);

GET an item.

__Example:__

```js
Movie.get({
  year: 2001,
  title: 'A Beautiful Mind'
}, done);
```

#### Author

* Contact: [hi@danamajid.com][1]
* Twitter: [http://twitter.com/dnmjd][2] 

  [1]: mailto:hi@danamajid.com
  [2]: http://twitter.com/dnmjd


#### Credits

Shout out to [Nathan Peck](https://github.com/nathanpeck) for sharing his exploration project

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