Live data from Hacker News

BookShelf, Simple ORM for Node

github.com

1–10 of 27 posts

Re: BookShelf, Simple ORM for Node

#3
My biggest problem with bookshelf is that it automatically grabs column names, so you don't (by default) have any representation in code of what the dang model looks like. Since JS is not typed, this can lead to a lot of having no idea what might be going on unless you wrote the code yourself

Re: BookShelf, Simple ORM for Node

#5
post #3

My biggest problem with bookshelf is that it automatically grabs column names, so you don't (by default) have any representation in code of what the dang model looks like. Since JS is not typed, this can lead to a lot of having no idea what might be going on unless you wrote the code yourself

On the other hand, this behavior is quite nice if you want to quickly build something around an existing database and you don't really want to spend time reenumerating the entire schema in code before being able to leverage the ORM.

Re: BookShelf, Simple ORM for Node

#6
I was battling with Sequelize JS for a long time, then discovered Bookshelf. A breath of fresh air, it works so much better. Plus, the underlying library (Knex) is also fantastic for raw queries, migrations, etc.

Re: BookShelf, Simple ORM for Node

#7
post #3

My biggest problem with bookshelf is that it automatically grabs column names, so you don't (by default) have any representation in code of what the dang model looks like. Since JS is not typed, this can lead to a lot of having no idea what might be going on unless you wrote the code yourself

On the other hand, this behavior is quite nice if you want to quickly build something around an existing database and you don't really want to spend time reenumerating the entire schema in code before being able to leverage the ORM.

Meh you essentially are re-enumerating it though, every time you access a field. There is an implicit contract being built up by the code written. I don't find that creating types to make this contract explicit takes much time at all, and there are significant benefits. Unfortunately it simply isn't an option in JS (maybe one could with TypeScript).

Re: BookShelf, Simple ORM for Node

#8
post #6

I was battling with Sequelize JS for a long time, then discovered Bookshelf. A breath of fresh air, it works so much better. Plus, the underlying library (Knex) is also fantastic for raw queries, migrations, etc.

Out of curiosity, what were you battling with? I've been using them for some time now and have only had good things to say, so curious about your pain points. Ability to plug in custom queries, sensible defaults with options to override everything, and a responsive maintainer have all been great.

Re: BookShelf, Simple ORM for Node

#9
Bookshelf isn't bad - but also make sure to check out knex, which Bookshelf is build on top of. Knex is a great Dapper like micro ORM/query builder if you'd just rather do most of your work in SQL.
Post reply on HN