5 ms·
Seems interesting ! I would definitely like more ORM for node.js technologies. The concurrent are Sequelize (http://sequelizejs.com/ http://sequelizejs.com/) a
by mackwic 12y ago
Seems interesting ! I would definitely like more ORM for node.js technologies.
The concurrent are Sequelize (http://sequelizejs.com/ http://sequelizejs.com/) and Bookshelf (http://bookshelfjs.org/ 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 ?
- aselzer 12y agoAnd if you just want a flexible ORM without models, knex (http://knexjs.org/ http://knexjs.org/), which bookshelf uses. I found knex + Postgres to be a great combination.
- whatthemick 12y agoLikely also better performance with just using Knex. Any ORM likely adds overhead, Sequelize definitely does, although we keep working on reducing that overhead - But inevitably features === overhead.
- igl 12y agoI 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.
- wilmoore 12y agoI personally wouldn't consider Knex an ORM. I'd describe it more as: A cohesive set of functions that help you build and execute SQL operations.
- whatthemick 12y agoNeither Sequelize nor Bookshelf has persistence ignorance as far as i know.
- mackwic 12y agoOk, after a lookup, "persistence ignorance" is the ability to have implicit save of the models when things change. Bookshelf has events, which make very easy to wire some kind of persistence ignorance (we implement it in our base Model class).
- whatthemick 12y agoI would expect those events to be triggered by action though, then it wouldn't be persistence ignorance.
- k__ 12y agoSequelize has the build method, which persists automatically. Couldn't the rest be achieved by simply adding a few (update, delete) methods to the model classes?
- lroal 12y agoRdb 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
- doublerebel 12y agoGreat question. To me what Node is missing most is a ORM that isn't tied to a backend -- relationships can easily be expressed without needing to know whether data is fetched through an API or through SQL. This is how ORM is often done in frontend JS. We're working on and using such a backend-agnostic Node lib, but I don't think it's polished enough for release yet.