thinky
RethinkDB ORM for Node.js
Last updated a year ago by neumino .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install thinky 
SYNC missed versions from official npm registry.

Thinky

=============================== Wercker status Light Node.js ORM for RethinkDB.

Quick start

Install:

npm install thinky

Use:

var thinky = require('thinky')();
var type   = thinky.type;

// Create a model - the table is automatically created
var Post = thinky.createModel("Post", {
  id: String,
  title: String,
  content: String,
  idAuthor: String
}); 

// You can also add constraints on the schema
var Author = thinky.createModel("Author", {
  id: type.string(),      // a normal string
  name: type.string().min(2),  // a string of at least two characters
  email: type.string().email()  // a string that is a valid email
});

// Join the models
Post.belongsTo(Author, "author", "idAuthor", "id");

Save a new post with its author.

// Create a new post
var post = new Post({
  title: "Hello World!",
  content: "This is an example."
});

// Create a new author
var author = new Author({
  name: "Michel",
  email: "orphee@gmail.com"
});

// Join the documents
post.author = author;


post.saveAll().then(function(result) {
  /*
  post = result = {
    id: "0e4a6f6f-cc0c-4aa5-951a-fcfc480dd05a",
    title: "Hello World!",
    content: "This is an example.",
    idAuthor: "3851d8b4-5358-43f2-ba23-f4d481358901",
    author: {
      id: "3851d8b4-5358-43f2-ba23-f4d481358901",
      name: "Michel",
      email: "orphee@gmail.com"
    }
  }
  */
});

Retrieve the post with its author.

Post.get("0e4a6f6f-cc0c-4aa5-951a-fcfc480dd05a").getJoin().run().then(function(result) {
  /*
  result = {
    id: "0e4a6f6f-cc0c-4aa5-951a-fcfc480dd05a",
    title: "Hello World!",
    content: "This is an example.",
    idAuthor: "3851d8b4-5358-43f2-ba23-f4d481358901",
    author: {
      id: "3851d8b4-5358-43f2-ba23-f4d481358901",
      name: "Michel",
      email: "orphee@gmail.com"
    }
  }
  */
});

Documentation

https://www.justonepixel.com/thinky (branch `gh-pages).

Help

No SLA, but a few developers hang out there and may be able to help:

Run the tests

npm test

Contribute

You are welcome to do a pull request.

Roadmap

The roadmap is defined with the issues/feedback on GitHub. Checkout:
https://github.com/neumino/thinky/issues

Author

Contributors

License

MIT, see the LICENSE file

Current Tags

  • 2.3.9                                ...           latest (a year ago)

129 Versions

  • 2.3.9                                ...           a year ago
  • 2.3.8                                ...           2 years ago
  • 2.3.7                                ...           2 years ago
  • 2.3.6                                ...           2 years ago
  • 2.3.5                                ...           2 years ago
  • 2.3.4                                ...           2 years ago
  • 2.3.3                                ...           2 years ago
  • 2.3.2                                ...           3 years ago
  • 2.3.1                                ...           3 years ago
  • 2.2.8                                ...           3 years ago
  • 2.3.0                                ...           3 years ago
  • 2.2.7                                ...           3 years ago
  • 2.2.6                                ...           3 years ago
  • 2.2.5                                ...           3 years ago
  • 2.2.4                                ...           3 years ago
  • 2.2.3                                ...           3 years ago
  • 2.2.2                                ...           3 years ago
  • 2.2.1                                ...           3 years ago
  • 2.2.0                                ...           3 years ago
  • 2.1.12                                ...           3 years ago
  • 2.1.11                                ...           3 years ago
  • 2.1.9                                ...           3 years ago
  • 2.1.8                                ...           3 years ago
  • 2.1.6                                ...           3 years ago
  • 2.1.5                                ...           3 years ago
  • 2.1.4                                ...           3 years ago
  • 2.1.3                                ...           3 years ago
  • 2.1.2                                ...           3 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.13                                ...           3 years ago
  • 2.0.12                                ...           3 years ago
  • 2.0.11                                ...           3 years ago
  • 2.0.10                                ...           3 years ago
  • 2.0.9                                ...           3 years ago
  • 2.0.8                                ...           3 years ago
  • 2.0.7                                ...           3 years ago
  • 2.0.6                                ...           3 years ago
  • 2.0.5                                ...           4 years ago
  • 2.0.4                                ...           4 years ago
  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.16.12                                ...           4 years ago
  • 1.16.11                                ...           4 years ago
  • 1.16.10                                ...           4 years ago
  • 1.16.9                                ...           4 years ago
  • 1.16.8                                ...           4 years ago
  • 1.16.7                                ...           4 years ago
  • 1.16.6                                ...           4 years ago
  • 1.16.5                                ...           4 years ago
  • 1.16.4                                ...           4 years ago
  • 1.16.2                                ...           4 years ago
  • 1.16.1                                ...           4 years ago
  • 1.16.0                                ...           4 years ago
  • 1.15.10                                ...           4 years ago
  • 1.15.9                                ...           4 years ago
  • 1.15.8                                ...           4 years ago
  • 1.15.7                                ...           4 years ago
  • 1.15.6                                ...           4 years ago
  • 1.15.5                                ...           4 years ago
  • 1.15.4                                ...           4 years ago
  • 1.15.3                                ...           4 years ago
  • 1.15.2                                ...           4 years ago
  • 1.15.1                                ...           4 years ago
  • 1.15.0                                ...           4 years ago
  • 1.14.5                                ...           4 years ago
  • 1.14.4                                ...           4 years ago
  • 1.14.3                                ...           4 years ago
  • 1.14.2                                ...           4 years ago
  • 1.14.1                                ...           4 years ago
  • 1.14.0                                ...           4 years ago
  • 1.13.12                                ...           4 years ago
  • 1.13.11                                ...           4 years ago
  • 1.13.10                                ...           4 years ago
  • 1.13.9                                ...           4 years ago
  • 1.13.8                                ...           4 years ago
  • 1.13.7                                ...           4 years ago
  • 1.13.6                                ...           4 years ago
  • 1.13.5                                ...           4 years ago
  • 1.13.4                                ...           4 years ago
  • 1.13.3                                ...           4 years ago
  • 1.13.2                                ...           4 years ago
  • 1.13.1                                ...           4 years ago
  • 1.13.0                                ...           4 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.6                                ...           5 years ago
  • 1.0.5                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.2.25                                ...           5 years ago
  • 0.2.24                                ...           5 years ago
  • 0.2.23                                ...           5 years ago
  • 0.2.22                                ...           5 years ago
  • 0.2.21                                ...           5 years ago
  • 0.2.20                                ...           5 years ago
  • 0.2.19                                ...           5 years ago
  • 0.2.18                                ...           5 years ago
  • 0.2.17                                ...           5 years ago
  • 0.2.16                                ...           5 years ago
  • 0.2.15                                ...           5 years ago
  • 0.2.14                                ...           5 years ago
  • 0.2.13                                ...           5 years ago
  • 0.2.12                                ...           5 years ago
  • 0.2.11                                ...           5 years ago
  • 0.2.10                                ...           5 years ago
  • 0.2.9                                ...           5 years ago
  • 0.2.8                                ...           5 years ago
  • 0.2.7                                ...           5 years ago
  • 0.2.6                                ...           5 years ago
  • 0.2.5                                ...           5 years ago
  • 0.2.4                                ...           5 years ago
  • 0.2.3                                ...           5 years ago
  • 0.2.2                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.7                                ...           5 years ago
  • 0.1.6                                ...           5 years ago
  • 0.1.5                                ...           5 years ago
  • 0.1.4                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago

Copyright 2014 - 2016 © taobao.org |