Wetland is a modern object-relational mapper (ORM) for node.js.

Features

Wetland is based on the JPA-spec and therefore has some similarities to Hibernate and Doctrine. While some aspects of the ORM have been adapted to perform better in the Node.js environment and don't follow the specification to the letter for that reason, the JPA specification is a stable and well written specification that makes wetland structured and performant.

New! Take a look at our wetland tutorial.

New! Wetland CLI now has its own repository. npm i -g wetland-cli .

New! Wetland has a nice entity generator. Let us do the heavy lifting. Repository can be found here.

The major features this ORM provides are listed below. Looking at the tests will provide more detailed information, pending full documentation.

Unit of work

Derived tables

Transactions

Entity manager

Manager scopes

Cascade persist

Deep joins

Repositories

QueryBuilder

Mapping

MetaData

Entity proxy

Collection proxy

Criteria parser

More...

Installation

To install wetland run the following command:

npm i --save wetland

Typings are provided by default for TypeScript users. No additional typings need installing.

Plugins / essentials

Usage

Simple implementation example:

const Wetland = require ( 'wetland' ).Wetland; const Foo = require ( './entity/foo' ).Foo; const Bar = require ( './entity/foo' ).Bar; const wetland = new Wetland({ stores: { simple: { client : 'mysql' , connection: { user : 'root' , database: 'testdatabase' } } }, entities: [Foo, Bar] }); let migrator = wetland.getMigrator().create(); migrator.apply().then(() => {}); let manager = wetland.getManager(); let repository = manager.getRepository(Foo); repository.find({name: 'cake' }, {populate: [ 'candles' , 'baker' , 'baker.address' ]}) .then(results => { });

License

MIT