The concurrent are Sequelize (http://sequelizejs.com/) and Bookshelf (http://bookshelfjs.org/), both very mature libraries (look at the Sequelize test suite, it's quite impressing !). Iroal, any comment on the rdb choices against these two big guys ? How can we expect rdb to evolve ?
It was created because we needed a solution with persistence ignorance and that does not have any constraints on foreign key naming, columns, table and so on. By persistence ignorance I mean not needing to call model.save() or pass the connection around everywhere - just edit the properties and commit the transaction.
Everything in rdb is developed TDD outside-in. So it has a lot of unit tests, but not that many integration tests. There are running examples in the demo repo though that could be considered as kind of integration tests.
Choices against sequelize and bookshelf: that is not my mission. If you want a closer integration with express.js, those orms are a better fit than rdb. My main focus on rdb was to keep the API simple and expose as little of the interior as possible - Tell Dont Ask principle.
How to expect rdb to evolve ? -domain logic -aggregate functions -order by -support sqlLite
I found knex + Postgres to be a great combination.
I work on a mongo project and doing aggregate queries is really ugly and painful. Everyone praising mongo probably never made "advanced" queries like that or dismissed SQL as shitty and unsecure without ever using it.
A cohesive set of functions that help you build and execute SQL operations.
Bookshelf has events, which make very easy to wire some kind of persistence ignorance (we implement it in our base Model class).
The people who defend callbacks either don't understand the benefits that promises provide, don't know about async/await or are suffering from stockholm syndrome.
Callbacks do not pass the reversibility test. If everyone had started out with promises and / or async/await, and someone proposed callbacks as a way to deal with this instead, they'd be dismissed as a fool. They're an accident of history and we should forget about them as quickly as possible.
Both interfaces can be abused to give you an ever growing indent and give the appearance of "callback hell"
Both interfaces can be use elegantly to help you reason about your code, make it easy to follow, and handle errors centrally.
Only one is supported natively by node.js and is the standard async interface for 90% of node.js's libraries: Callbacks.
Also, regarding "callback hell", a straw-man argument against callbacks, I highly suggest reading http://callbackhell.com/
I'm currently checking out ORMs for node.
What I found was Bookshelf, Sequelize and Jugglingdb.
I think Rdb needs SQLite support for development purposes and smaller projects.
https://sequelize.readthedocs.org/en/latest/docs/migrations/
- JSON's nature is already very 'object oriented' and I use in code JSON data like it saved—no translation beetween clunky SQL and objects is necessary (if I have a DB which saves JSON natively like Mongo)
- Mongo allows to directly save JSON and stuff like migrations is stuff from the past since tables/collections don't have to be created
- Mongo's Native Driver is low level and at the same time fully sufficient, the syntax is not beautiful and tons of libs sit on top to make it beautiful but I still don't see the need for a real ORM
So, Mongo's Native Driver is your best friend and validations are often a matter of a few lines. Or did I miss anything which is life saving I get from ORMs in a Node/Mongo setup?
But I am wondering who is using SQL based DBs with Node, feels ancient to me, except you build the next datastore for a bank but even then. Also Postgres with its JSON options does not give the feeling, flexibility and speed as Node/Mongo.
I could imagine that the larger part of Node users are working with Mongo, or not?