Remodel
Generator-based query interface for rethinkdb.
A simple wrapper around the excellent rethinkdb lib, with generator support, and some modeling goodness thrown in.
Installation
$ npm install remodel
Example
var r = ;var co = ; var remodel = 'localhost'; var User = remodel; ;
Usage
var r = ; // Provide connection details when requiring remodel.// These connection details are passed directly to reql-then// which sets up a connection pool for youremodel = { host: 'localhost' port: 28015 db: 'test' authKey: '' maxPoolSize: 10 // set to 1 to disable connection pooling}); // query interface { // accepts any rethinkdb query // returns actual results, not a cursor remodel; remodel; remodel; // aliases remodel; ;} // model interfacevar User = remodel; // pass the table name { Userall; // returns all users // add your own helper finder methods User { return this; } // use regular rethinkdb querying var user = User; // primary key lookup var users = User; var users = User; // use an index for faster querying // complete list Userbetween Usercount Userfilter UserforEach Userget UsergetAll UsergroupBy UsergroupedMapReduce UserindexCreate UserindexList UserindexWait Userinfo Userinsert Userlimit Usermap UserorderBy Userpluck Userskip Userunion UserwithFields Userwithout}
License
MIT