Live data from Hacker News

Rdb – a Node.js ORM with transactions, persistence ignorance and promises

npmjs.com

11–20 of 47 posts

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#11
post #2

Seems interesting ! I would definitely like more ORM for node.js technologies. 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 ?

Rdb is used in commercial products at my employer Timpex (www.timpex.no). So it will definitely be maintained. The code was initially closed source in csharp, we refined it and released it as OSS in javascript.

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

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#12
post #9

ORMs are not really required in a Node/Mongo/JSON setup anymore: - 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 Nat…

Not everyone is only using Mongo with Node

Good point and I just checked: rdb seems to be for SQL based DBs.

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?

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#13
post #12

Earlier quoted context omitted.

Not everyone is only using Mongo with Node

Good point and I just checked: rdb seems to be for SQL based DBs. 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?

Rdb (Relational Database) is meant only for Relation Databases (sql). I have no plans on supporting document databases - that would probably a bad compromize. And the api would be affected in a negative way.

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#14
post #12

Earlier quoted context omitted.

Not everyone is only using Mongo with Node

Good point and I just checked: rdb seems to be for SQL based DBs. 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?

Well it depends on what you're building surely? Anything with relational data would fit in a RDBMS more than it would Mongo.

E-Commerce is one area that isn't `ancient` and that would need the reliability of a traditional ACID compliant DB like Postgresql.

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#15
post #9

ORMs are not really required in a Node/Mongo/JSON setup anymore: - 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 Nat…

Mongo does not give you transactions.

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#16
post #4
post #2

Seems interesting ! I would definitely like more ORM for node.js technologies. 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 ?

And if you just want a flexible ORM without models, knex ( http://knexjs.org/ ), which bookshelf uses. I found knex + Postgres to be a great combination.

I really really really like Knex. While Mongo claims to be "easy" and "js-native", It's far easier doing complicated queries with Knex on Postgres than on Mongo with the official client.

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.

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#17
post #12

Earlier quoted context omitted.

Not everyone is only using Mongo with Node

Good point and I just checked: rdb seems to be for SQL based DBs. 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?

Mongo is great for when you're rapidly developing a product and/or still operating at a small-medium scale.

Once you start to really scale, you'll start to find a couple parts of MongoDB break-down:

1. MongoDB has no concept of transactions and is not ACID compliant. These short-comings seem innocuous enough at first, but you end up with some crazy potential race conditions that you just end up praying you never face.

2. Distributed MongoDB layers are difficult to implement as well as maintain.

3. MongoDB Replica sets are unpredictable and unreliable in the speed at which they are able to stay up to date and require changes to your code to fully utilize (since you need to ensure you are always reading from a replica when you can, but only ever writing to the master MongoDB instance)

4. At scale, MongoDB will consistently perform worse than Postgres for CRUD-based operations

5. Do you have true relations between documents? Do you ever use Mongoose's convenient `populate()` functionality? If so, you are now making multiple db queries in series when trying to fetch a document(s) from a single collection. This starts to really hurt your query times once you get enough documents/relations in your mongo collections.

I'm sure I'm missing some, but these are some of the areas where MongoDB has fallen down for me in the past.

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#18
post #12

Earlier quoted context omitted.

Not everyone is only using Mongo with Node

Good point and I just checked: rdb seems to be for SQL based DBs. 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?

> But I am wondering who is using SQL based DBs

Maybe if you are working with data which inherently has a relational structure using a relational database makes sense. Maybe if you need to ensure transactional consistency, you want to use a data-store which is ACID compliant.

You know: There's no silver hammer. Use the right tool for the right job. Etc etc.

Just a though. A sprinkle of old man's dust onto this new hip generation who thinks JSON solves all the problems in the world.

Re: Rdb – a Node.js ORM with transactions, persistence ignorance and promises

#20

Any chance Rdb plans to support a traditional callback style interface for those of us that prefer to stay away from promises?

I might be missing something but why would you prefer callbacks over promises? I've heard of 'callback hell' but never heard of 'promise hell'.
Post reply on HN