ORM for cloud spanner for nodejs - google-cloud-spanner

Is there an implementation of ORM for cloud spanner in nodejs?
I can see that we can use the good old knex.js for mostly read operations, but that also seems more like a workaround.

If you are willing to go for unofficial and (probably) unsupported implementations, then there is this repository that adds support for Spanner to TypeORM: https://github.com/Rocketmakers/typeorm/tree/master/src/driver/spanner
It might be worth a try, and as it is open source, you have the possibility of adding features yourself. I have not tried it out myself, so I don't know how much it actually supports.

Unfortunately, I don't believe there is support for any ORMs in NodeJS at the moment. There is only ORM support for Hibernate, Spring Data and Django (beta).

Related

How difficult is it to choose an ORM for Node.js? Or Node.js lacks a mature ORM

I have a production project to develop. It's an e-commerce site.
My current stack:
Node.js
TypeScript
PostgreSQL
Now I have to choose an ORM for this project.
I think I have two options:
TypeORM. I've used this ORM before. It's good and stable software, but TypeORM has had maintenance issues for a while. I'm not sure about the future of this ORM.
MikroORM. TypeORM lacks some useful features like #Filters (scopes) and bulk subscribers, while MikroORM on the other hand has these features or alternatives (see filters and alternative to bulk subscribers). But MikroORM is less popular and relatively new. And many of MikroORM's features are still in alpha
Summary
ORM with lack of maintenance and features but stable or ORM with great maintenance, new features, but not battle-tested.
Which option is better? Or maybe there are some alternatives?
You can check Sequelize - https://sequelize.org, it has a TypeScript support, but the syntax is kind of ugly in my opinion.
Among the three, Sequelize is the most mature ORM.
TypeORM is very nice, but has some major bugs like this - https://github.com/typeorm/typeorm/issues/3095. I came across to same or maybe similar problem related with saving one to many relations which i think is one of the most important features of every ORM and it must works properly.
I used MikroORM for a while - Again there are some minor problems which fortunately will be fixed in version 4. Overall, most of the features works properly and almost all of the problems that i had was resolved very quickly after reporting them on github.
I recommend Prisma, a new NodeJS ORM with great features and documentation.
there are a orm named #gradii/fedaco. code converted from laravel eloquent. currently still in wip
actually right now I have no time and interest take long time to maintain this project.
typescript code and part of test is not published to public.

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.

node-postgres vs pg-promise for Nodejs Application

I'm going to build a Nodejs application with Postgresql as back end. I'm not going to use ORMs like Sequelize due to poor documentation and performance problems or any other ORM - ORM is an anti-pattern.
I found node-postgres and pg-promise are candidates in this regard. So, can anyone clarify the scenarios which one of the tools is better than the other or which one is way to go with description, provided that node-postgres has been developing since 2010 and pg-promise since 2015.
pg-promise uses node-postgres internally. AFAIK pg-promise is a promise-based set of higher-level APIs on top that you might find useful. I'd recommend using whichever you feel more comfortable with. I'm the author of node-postgres.

ActionHero.js Framework with Oracle database persistence

I am quite new working with nodejs, I need to make a REST API that can work with websocket. I was searching for a framework that I could work with, I found actionhero.js, I think that can fit my needs.
But I see a little problem with this framework, that I can't find information about how can I make it work with oracle database, I will be really grateful if any of you can give me a light on how can I make it work this framework with a Oracle Database, or suggest me a framework based on REST API that can fit my needs.
Thank you.
Actionhero is, as you point out, a REST API framework. It doesn't include any database drivers (other than for redis, which it uses for cluster communication). You can easily ad support for any database you like in an initializer.
There are also plugins which add database support. For example, the ah-sequelize-plugin adds support for the Sequelize ORM, probably the most popular node.js ORM. Sequelize doesn't support the Oracle DB out of the box (very few things do), but there exist drivers you can use: https://github.com/adeo-proxideco/sequelize-oracle

Schemaless Driver Options?

So i'm a bit conflicted. I want a quality driver/library to access that is also Schemaless, but it seems the only active MongoDB library for Nodejs is Mongoose.
Now, Mongoose is great and all, but again.. it's a Schema based library, and i don't want to use one with Mongo for this project.
So, the options i have found that fit my criteria (not Mongoose) are as follows..
Mongodb Native
Probably the most widely used option, and the foundation for other libraries, but not the most friendly. The deeply nested callbacks can quickly become ugly, im my opinion.
MongoSkin
This is a decent option, and it appears to allow a lot of access to normal Mongo constructs, but at the same time it is poorly documented and not all that active.
Mongolian
My personal preference.. but it lacks access to much of Mongo's constructs, and the project seems nearly dead.. It's basically had no activity in a year.
Mongojs
Likely the most recently active between the three wrappers, but it lacks GridFS support (that i see).
Are there any other options i am missing?
edit: Adding other libs to the list..
I'd recommend you look at either:
Directly using the native node.js library mongodb-native (upon which all these are based).
mongojs, which minimally wraps the native library to emulate the official mongodb API as much as possible.

Resources