🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

node-dynamodb

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-dynamodb

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

0.0.3
latest
npm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 26 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts