0.0.3 • Published 7 years ago

node-dynamodb v0.0.3

Weekly downloads
2
License
ISC
Repository
-
Last release
7 years ago

node-dynamodb CircleCI

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

DynamoDB

Example:

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

Methods

DynamoDB.model(schema, options)

Define your model.

Example:

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:

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:

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

Movie.get(details, callback);

GET an item.

Example:

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

Author

Credits

Shout out to Nathan Peck for sharing his exploration project

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

8 years ago