1.2.0 • Published 7 years ago

thinodium-rethinkdb v1.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Thinodium RethinkDB adapter

Build Status npm Join the chat at https://discord.gg/bYt4tWB Follow on Twitter

A RethinkDB adapter for thinodium which internally uses rethinkdbdash.

Features:

  • Creates tables and indexes if they don't already exist.

Installation

$ npm install thinodium thinodium-rethinkdb

Usage examples

const Thinodium = require('thinodium');

const db = yield Thinodium.connect('rethinkdb', {
  // db name
  db: 'mydb',
  /* all options get passed to rethinkdbdash module */
  ...
});

/*
  This will create the "User" table and all specifies indexes if they
  don't already exist.
 */
const User = yield db.model('User', {
  indexes: [
    // single-value field
    {
      name: 'username',
    },
    // a multivalue field
    {
      name: 'roles',
      options: {
        multi: true,
      },
    },  
    // totally custom indexing function
    {
      name: 'email',
      def: function(doc) {
        return doc('emails')('email');
      },
      options: {
        multi: true,
      },
    },
  ],
});

// insert a new user
let user = yield User.insert({
  name: 'john'
});

// ... normal thinodium API methods available at this point

Check out the thinodium docs for further usage examples and API docs.

Building

To run the tests you will need RethinkDB installed and running with default host and port settings. Then on the command-line:

$ npm install
$ npm test

Contributing

Contributions are welcome! Please see CONTRIBUTING.md.

License

MIT - see LICENSE.md

1.2.0

7 years ago

1.1.3

7 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.3

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago