What is RethinkDB?


RethinkDB was an open-source distributed NoSQL database storing JSON documents and scaling data for applications. It inverts the traditional database architecture by exposing an exciting new access model – instead of polling for changes, the developer can tell RethinkDB to continuously push updated query results to applications in realtime. RethinkDB’s realtime push architecture dramatically reduces the time and effort necessary to build scalable realtime apps.

Dead

RethinkDB project die in 2017

When we announced that RethinkDB is shutting down, I promised to write a post-mortem. I took some time to process the experience, and I can now write about it clearly.

In the HN discussion thread people proposed many reasons for why RethinkDB failed, from inexplicable perversity of human nature and clever machinations of MongoDB’s marketing people, to failure to build an experienced go-to-market team, to lack of numeric type support beyond 64-bit float

Using RethinkDB with RoR


generate a new Rails app using NoBrainer, which is a RethinkDB ORM, that is an almost drop-in replacement for ActiveRecord

$ rails new nb_app
$ cd nb_app
$ echo "gem 'nobrainer'" >> Gemfile
$ bundle install
$ rails g nobrainer:install

Then, generate models

$ rails g scaffold Article title:string text:string tags:array

In app/models/article.rb

class Article
  include NoBrainer::Document
  include NoBrainer::Document::Timestamps

  field :title, :type => String
  field :text, :type => String
  field :tags, :type => Array
end

The NoBrainer generator automatically includes the TimeStamps mixin that adds the fields created_on and updated_on. You’ll also notice this created a simple secondary index on the name field. In order to add the index to the database, you can use the Rake task:

$ rake nobrainer:sync_schema

You’re now up and running with RethinkDB and Rails!