DynamoDB ORM for Node.js
A DynamoDB ORM for Node.js
It aims to provide a few added features that most people will want from a DynamoDB tool. These things include a Mongoose inspired way of doing things, periodic S3 backups, multi-indexing (clones data to seperate tables, having different indexes on each) and more.
For now it provides a simple way to interact with DynamoDB and create/read rows in the table. More features coming.
=blog_post_schema =attributes:author: Stringtitle: Stringbody: Stringdate: Numberindex: type:'hash'field:'author'type:'range'fields:'title''date'BlogPost = dynasaurmodel 'BlogPost'blog_post_schema
First make sure that the
AWS_SECRET_ACCESS_KEY shell variables are set to their respective values.
aws_settings =credentials:accessKeyId: processenvAWS_ACCESS_KEY_IDsecretAccessKey: processenvAWS_SECRET_ACCESS_KEYregion:'us-west-1'Dynasaur = require '../../lib/Dynasaur'dynasaur = aws_settingsBlogPost = require'./models/BlogPost'dynasaurblog_post = BlogPostnewblog_post.title = 'Dynasaur'blog_post.author = 'Someone'blog_post.body = 'Dynasaur is a DynamoDB ORM that builds some neat features on top of DynamoDB'blog_post.date = getTimeblog_postsaveconsolelog err
The tool every serious tech blogger needs
BlogPostfindconsolelog blog_postsn = Mathfloor Mathrandom * blog_postslengthBlogPostget id:blog_postsnidconsolelog blog_post_to_deleteblog_post_to_deleteremoveconsolelog 'REMOVED'
A big thanks go out to Jed Schmidt and other contributors for dynamo which sits as an API abstraction for DynamoDB that made this process significantly easier.
Another big thanks go out to all the contributors of mongoose as it was a huge inspiration to the design of how users interact with the project.
(The MIT License)
Copyright (c) 2012 Travis Glines <travisglines [->] gmail.com >
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.