A simple ORM for Node.js that takes care of the repetitive CRUD tasks, while providing a handy interface for custom queries.
$ npm install naomi
|Connector||Maintainer||Build status||npm version|
Install naomi and the appropriate connector for your database, e.g.
$ npm install naomi --save$ npm install naomi-mysql --save
Register connector with Naomi under name "mysql".
var naomi = ;var mysql = ;naomi;
var db = naomi;
Connect to database using Database#connect(). Please note you may use the callback interface instead of promises.
Run custom queries using Database#execute().
var sql = ;var params = ;db;
You wouldn't normally use an ORM to run custom queries. Naomi provides a Collection interface to map database collections (e.g. tables) to objects and run repretitive CRUD tasks.
Use Database#collection() to create a new Collection.
var employees = db;
var employees = db;employees;
The Collection class exposes the following methods:
Additional collection methods may exist depending on the database connector.
Databases, besides data, contain meta-data; stuff like
These meta-data can be extracted from the database and are sufficient for generating basic validation rules and application structure. Yet most ORM tools tend to ignore meta-data living in the database and replicate that information in the application layer, which results to:
Naomi is different in 2 ways:
With Naomi you have the freedom to create the database using a tool of your choice, e.g. MySQL Workbench or pgAdmin. While this approach may seem intriguing to new developers, it is in fact the natural way of thinking for experienced engineers. Creating a database requires creativity and imagination that machines lack. It is a task made for humans.
This project would not be without the extraordinary work of:
Source code contributions are most welcome. The following rules apply: