https://github.com/thinodium/thinodium-rethinkdb
RethinkDB adapter for Thinodium ODM library
https://github.com/thinodium/thinodium-rethinkdb
database nodejs odm plugin rethinkdb
Last synced: 5 months ago
JSON representation
RethinkDB adapter for Thinodium ODM library
- Host: GitHub
- URL: https://github.com/thinodium/thinodium-rethinkdb
- Owner: thinodium
- Created: 2016-04-27T08:08:07.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-15T18:53:46.000Z (over 9 years ago)
- Last Synced: 2025-08-19T12:13:30.771Z (10 months ago)
- Topics: database, nodejs, odm, plugin, rethinkdb
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Thinodium RethinkDB adapter
[](http://travis-ci.org/thinodium/thinodium-rethinkdb)
[](https://www.npmjs.com/package/thinodium-rethinkdb)
[](https://discord.gg/bYt4tWB)
[](https://twitter.com/hiddentao)
A RethinkDB adapter for [thinodium](https://github.com/thinodium/thinodium)
which internally uses [rethinkdbdash](https://github.com/neumino/rethinkdbdash).
Features:
* Creates tables and indexes if they don't already exist.
## Installation
```bash
$ npm install thinodium thinodium-rethinkdb
```
## Usage examples
```js
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](https://hiddentao.github.io/thinodium) for further usage examples and API docs.
## Building
To run the tests you will need [RethinkDB](https://www.rethinkdb.com/) 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](https://github.com/thinodium/thinodium-rethinkdb/blob/master/CONTRIBUTING.md).
## License
MIT - see [LICENSE.md](https://github.com/thinodium/thinodium-rethinkdb/blob/master/LICENSE.md)