Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good object mapper for Amazons dynamodb(through aws sdk) which can be used in nodejs?

Maybe the question does not apply to dynamoDB due to it not being Relational Db. However, I'm looking for a good object mapper which can be used in nodejs and aws sdk to map existing model classes to dynamoDB tables. Does anyone have experience with this issue/question, or have you used such a module/library?

like image 431
Fazi Avatar asked May 21 '14 13:05

Fazi


People also ask

What is a DynamoDB Mapper?

The DynamoDBMapper class is the entry point to Amazon DynamoDB. It provides access to a DynamoDB endpoint and enables you to access your data in various tables. It also enables you to perform various create, read, update, and delete (CRUD) operations on items, and run queries and scans against tables.

Is there an ORM for DynamoDB?

TypeDORM is a feature-rich DynamoDB ORM to help you write high-quality, loosely coupled, scalable, and maintainable applications with highly relational data in the most productive way.

What is AWS SDK for DynamoDB?

Description. AWS SDK for JavaScript DynamoDB Client for Node. js, Browser and React Native. Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.

Is DynamoDB Mapper thread safe?

This class is thread-safe and can be shared between threads.


2 Answers

If you are looking for schema:

  • https://github.com/clarkie/dynogels (well supported forked from vogels which has been abandoned)
  • https://github.com/automategreen/dynamoose (inspired by Mongoose)

If you are looking for something to throw javascript objects (even circular graphs) to:

  • https://github.com/aaaristo/dyngodb (alpha)
  • https://github.com/aaaristo/angular-gson-express-dyngodb

dyngodb has experimental support for full-text search, and transactions too.

Both are based on aws-sdk.

like image 155
aaaristo Avatar answered Sep 19 '22 17:09

aaaristo


Also worth considering is simple marshallers, which just translate between the dynamoDB format and regular js objects or JSON.

DynamoDb-Data-Types
https://github.com/kayomarz/dynamodb-data-types
https://www.npmjs.com/package/dynamodb-data-types

"This utility helps represent AWS DynamoDb data types. It maps (marshalls) JavaScript data into the format required by DynamoDb."

dynamoDb-marshaler
https://github.com/CascadeEnergy/dynamoDb-marshaler https://www.npmjs.com/package/dynamodb-marshaler

"Translates sane javascript objects (and JSON) into DynamoDb format and vice versa." [does not support B type.]

Update 2016-06:
Just discovered that the AWS SDK now does this for you. Their documentation is only partially converted so I guess this is a recent addition. Read about it here.

But these marshallers are still useful because there are circumstances where you can't use the new document client, eg. when processing a dynamoDB stream.

like image 22
Tom Avatar answered Sep 18 '22 17:09

Tom