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.
Related
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).
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.
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
According to Meteor docs,
Today most Meteor apps use MongoDB as their database because it is the
best supported, though support for other databases is coming in the
future.
Also there is a great SQL ORM for Node — Sequelize
The question is: will Meteor and Sequelize combination work? Is it worth spending time on mixing them in one app? Or Meteor's Collection class tightly relies on MongoDB and it will be too complicated to implement Sequelize backend with it?
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.