DynamoDB wrapper for Node.js - node.js

What is the best npm library for dynamodb? There are quite a few on npm.
Right now my production application is running with a mongodb and mongoose.

Now things are becoming simple in Dynamodb using schema based AWS dynamodb data mapper library in Node.js
For more details, have a look on following aws package.
Data Mapper with annotation
Data Mapper package for Javascript
Advantages of using Amazon Data mapper library
Library take cares of Data marshaling
Schemas will be mapped to Javascript class entities
Similar to ORM
Developed by Amazon

There's a couple of good ones:
vogels and
dynamite
I'm using Vogels in my app at the moment, I like that it gives an extra layer of protection over your database via a Joi Schema, though it's not maintained as actively as you might like.
Dynamite is promise based and built by Medium, so it's worth a look as well.

Related

Is there hooks for native mongodb driver for node like in mongoose

Context: DDD project deployed as distributed event-based micro-services (also uses Onion architecture)
For saving data into persistence (mongodb), I am using native mongodb node.js driver (for some reasons not using ORM). I need to implement some kind of hooks to listen changes in data (entities) in db like user created, updated, basically CRUD. mongoose provides this kind of hooks, but I am not using mongoose as I mentioned earlier. I heard about new Change Streams feature in MongoDB (though only supported in replica-set/sharded deployments), and want to utilize this for implementing hooks.
Is there anyone used Change Streams for similar reasons, have any experience, any open-source library, etc would be really appreciated!!

How to mocking an insert to dynamodb with NodeJS?

We are using NodeJS framework. I need to mock a dynamoDb insert function. I am not sure how to set this up and all the Google'd examples are for queries. Anyone help me out? Thank you.
Might be you need something similar to https://www.npmjs.com/package/dynamoose to connect nodejs and dynamoDB. This is a similar library to mongoose which is used for nodejs and mongodb connection. It just not only handles connection but it is an object modeling tool for Amazon's DynamoDB.
Look here for Put and batchwrite operations samples from AWS. The node.js ones are in the midst of moving from v2 of the SDK to the newer v3 AWS JS SDK.

AWS DynamoDB-Data-Mapper NodeJS

I am planning to use AWS Dynamo-Data-Mapper for ORM mapping while creating lambda functions in NodeJS with DynamoDB storage. This library is still under developer preview. Does anyone has experience in using this library and is there a risk of using this library since it is still under developer preview? Is there any other better NodeJS library to use for ORM with Dynamo DB.
Personally I code in Java, and the Java DynamoDBMapper is the best DynamoDB SDK by a distance. It provides object modelling, optimistic locking and more. The only other supported high level SDK at the moment is the .Net Object Persistence Model, which is frankly not even close to being as good as DynamoDBMapper.
If you are using Lambda I personally wouldn't use Java, the functions take too long to run.
The AWS supported Javascript SDK does not provide object modelling.
I've seen a few projects that try and fill the gap for a Javascript DynamoDB object mapping SDK, such as dynamoose and dynogels. Personally I wouldn't use these as you simply end up losing functionality offered by DynamoDB. But I'm sure they are good in some circumstances, like prototyping applications rapidly.
I must admit I've not used the new AWS dynamodb-data-mapper (Javascript Object SDK). However its being developed by AWS and its pretty clear they are serious about it.
Clearly using the SDK depends on your project and appetite to risk. I get a huge amount of value using DynamoDBMapper (the equivalent Java SDK). My code is massively more clean and simple than it would be in a low level SDK.

Why we use ORM or ODM to manage any graphDB?

Hey everyone I am working on nodeJS app. I searched some modules to manage my database (orientdb).
My question is: Why we use any ORM or ODM (or why is it recommenced), because there is a module which can provide many functions to manage DB.
I am still confused what should I use orientorm (https://github.com/mav-im/orientorm) or oriento (https://github.com/codemix/oriento)
Thank in advance..
Depending on the goal and depending on the ORM, ORMs have the advantage of adding support for:
schemas / models / collections: this makes it easier to create all classes/properties and, in some cases, migrations;
validations: make it easier to verify what gets saved in the DB.
All OrientDB ORM's I've seen for node.js expose Oriento, so that makes it easy to access the underlying oriento methods for doing more complex stuff.
Having said all this I recommend you try the waterline ORM with waterline-orientdb adapter. Waterline is an adapter based ORM with support for multiple databases (including support for associations between databases). Waterline-orientdb is the adapter for OrientDB which is based on Oriento. If at any point you need to use Oriento you can call .getDB() to access Oriento's instance.
Oriento is much more mature and supported. I suggest you to go with it.

CRUD operations with Node.js and MongoDB

What is the optimal way to perform CRUD operations when using Node.js with MongoDB. Can I reuse the same queries that work on mongo shell? What advantages does a ODM like mongoose provide? Any other ODMs which fit into the mean.io stack?
vmr.
Well, I guess it depends of what you want to do.
Lets take what Mongoose says in their website:
Mongoose provides a straight-forward, schema-based solution to modeling your application data and includes built-in type casting, validation, query building, business logic hooks and more, out of the box.
Resuming what I understood of that it helps you to model your database and helps you to mantain your logic organized using model like in an MVC. It's a very mature ODM and very recomended for using with MVC.
In my personal experience I started using Monk, which did the trick for a while, but the I started to need to use aggregate and other stuff that apparently Monk can't handle. And I don't wanted to tie my system to an model because is a very mutable project, so I started using Mongoskin which is, at least for now, perfect for me because I can use pratically the same query that I use at Robomongo (Which is like a Navicat, PgAdmin, PhpMyAdmin but for MongoDB) in my ExpressJs code.
Mongoose is saving your time by mapping the JavaScript Data objects to the MongoDB database.
MongoDB and NodeJS Integration

Resources