Waterline is a brand new kind of storage and retrieval engine.
It provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get and store things like users, whether they live in Redis, MySQL, MongoDB, or Postgres.
Waterline strives to inherit the best parts of ORMs like ActiveRecord, Hibernate, and Mongoose, but with a fresh perspective and emphasis on modularity, testability, and consistency across adapters.
For detailed documentation, see the Waterline documentation.
Install from NPM.
$ npm install waterline
Waterline uses the concept of an adapter to translate a predefined set of methods into a query that can be understood by your data store. Adapters allow you to use various datastores such as MySQL, PostgreSQL, MongoDB, Redis, etc. and have a clear API for working with your model data.
It also allows an adapter to define its own methods that don't necessarily fit into the CRUD methods defined by default in Waterline. If an adapter defines a custom method, Waterline will simply pass the function arguments down to the adapter.
- PostgreSQL - 0.9+ compatible
- MySQL - 0.9+ compatible
- MongoDB - 0.9+ compatible
- Memory - 0.9+ compatible
- Disk - 0.9+ compatible
- Microsoft SQL Server
- Redis
- Riak
- Neo4j
- OrientDB
- ArangoDB
- Apache Cassandra
- GraphQL
- Solr
- Apache Derby
Need help or have a question? Click here.
To report a bug, click here.
Please observe the guidelines and conventions laid out in our contribution guide when opening issues or submitting pull requests.
All tests are written with mocha and should be run with npm:
$ npm test
As of Waterline 0.13 (Sails v1.0), these keys allow end users to modify the behaviour of Waterline methods. You can pass them as the meta
query key, or via the .meta()
query modifier method:
Model.find()
.meta({
skipAllLifecycleCallbacks: true
})
.exec();
Meta Key | Default | Purpose |
---|---|---|
skipAllLifecycleCallbacks | false | Set to true to prevent lifecycle callbacks from running in the query. |
dontIncrementSequencesOnCreateEach | false | For SQL adapters: set to true to prevent the default behavior of automatically updating a table's current autoincrement value (the "next value") in .createEach() in the case where one of the records is being created with a greater value than the current sequence number. |
dontReturnRecordsOnUpdate | false | For adapters: set to true to tell the database adapter to send back a special report dictionary (the raw result from the Waterline driver) INSTEAD of the default behavior of sending back an array of all updated records. Useful for performance reasons when working with updates that affect large numbers of records. |
MIT. Copyright © 2012-2016 Balderdash Design Co.
Waterline, like the rest of the Sails framework, is free and open-source under the MIT License.