angular-rethinkDB | Angular module for NoSQL realtime database

angular-rethinkDB module


Stars : 10

Forks : 10

Created by Mario Lenis

Download GitHub


This is an Angular module for RethinkDB NoSQL realtime database using Observables and, this is based and influenced by AngularFire2 module created by David East so, thanks to him.

This is an work in progress so apologies for the lack of documentation.


Here is a simple demo

Module 1st

In order to use this, you will need to build a backend seervice for RethinkDB, or you might use this one

import {AngularRethinkDBModule} from 'angular-rethinkdb';

  declarations: [...],
  imports: [
        api_key: 'AAAA-BBBBB-CCCCC',
        database: 'your-db',
        host: '<http | https>://<your-host><:port>'
  providers: [...],
  bootstrap: [AppComponent]
export class AppModule { }

Component Then

import {AngularRethinkDBService, AngularRethinkDBObservable, IRethinkDBQuery} from 'angular-rethinkdb';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';

interface IMyObjectType {

export class Component {
    myTable: AngularRethinkDBObservable<IMyObjectType>;
    myQuery$ = new BehaviorSubject<IRethinkDBQuery>(undefined);

    constructor(private ar: AngularRethinkDBService) {

        // Initialize your object from table, if does not exists, it will be created
        // : string, query$? : BehaviorSubject<IRethinkDBQuery>)
        this.myTable ='myTable', this.myQuery$);

        // Query data will register a new filter and only will listen to changes 
        // according to the next value of query
            limit: 100,
            orderBy: {
                index: 'lastUpdate',
                desc: true
            filter: {
                name: 'some name'

        // Subscribe to your object and listen to data
            .subscribe(data => console.log(data));

        // Push data
        let myNewData: IMyObjectType = {...};
            .subscribe(res => console.log(res));

        // Delete data by id
            .subscribe(res => console.log(res));

        // Delete data by custom index
        this.myTable.remove({ indexName:'custom-id', indexValue: 'id-value' })
            .subscribe(res => console.log(res));

        // Modify data
        let myUpdatedData = Object.assign(myNewData, {myProp: 'new value'});

        // Then update at myTable
                response => console.log(response),
                error => console.warn(error) // This is triggered if myUpdatedData has no id as property.

        // Or you can update by query filter using IRethinkDBQuery interface
        this.myTable.update(myUpdatedData, {
                filter: {
                    name: 'author'
                limit: 10
                response => console.log(response),
                error => console.warn(error)
  • Any change on 'myTable' will be published on subscribe method.
  • push, remove, update methods returns Observables to track the operation result
  • IRethinkDBQuery All properties are optional. Valid properties are limit: number, orderBy: string and filter : Object;


  • [ SECURITY ] Authentication.


Javascript plugin