dynamoose
Version:
Dynamoose is a modeling tool for Amazon's DynamoDB (inspired by Mongoose)
46 lines (29 loc) • 746 B
Markdown
title: Quick-Start
permalinks: /
layout: single
## Installation
$ npm install dynamoose
## Example
Set AWS configurations in environment variables:
```sh
export AWS_ACCESS_KEY_ID="Your AWS Access Key ID"
export AWS_SECRET_ACCESS_KEY="Your AWS Secret Access Key"
export AWS_REGION="us-east-1"
```
Here's a simple example:
```js
var dynamoose = require('dynamoose');
// Create cat model with default options
var Cat = dynamoose.model('Cat', { id: Number, name: String });
// Create a new cat object
var garfield = new Cat({id: 666, name: 'Garfield'});
// Save to DynamoDB
garfield.save();
// Lookup in DynamoDB
Cat.get(666)
.then(function (badCat) {
console.log('Never trust a smiling cat. - ' + badCat.name);
});
```