Need advice about which tool to choose?Ask the StackShare community!
Objection.js vs Bookshelf.js: What are the differences?
What is Objection.js? It is an ORM for Node.js. It aims to stay out of your way and make it as easy as possible to use the full power of SQL and the underlying database engine while still making the common stuff easy and enjoyable.
What is Bookshelf.js? Aims to provide a simple library for common tasks when querying databases in JavaScript. It stems from the Knex.js, which is a flexible query builder that works with PostgreSQL, MySQL and SQLite3. Bookshelf.js builds on top of this by providing functionality for creating data models, forming relations between these models, and other common tasks needed when querying a database.
Objection.js and Bookshelf.js can be categorized as "Object Relational Mapper (ORM)" tools.
Some of the features offered by Objection.js are:
- A declarative way of defining models and relationships between them
- Simple and fun way to fetch, insert, update and delete objects using the full power of SQL
- Powerful mechanisms for eager loading, inserting and upserting object graphs
On the other hand, Bookshelf.js provides the following key features:
- Table creation
- Manipulation
- Promise-based and traditional callback interfaces
Objection.js is an open source tool with 4.33K GitHub stars and 349 GitHub forks. Here's a link to Objection.js's open source repository on GitHub.
Pros of Bookshelf.js
- Uses both promises and callback methods3