Answers to common questions about RethinkDB

Note: this is a blog post from November 2012, and much of the information here is outdated. RethinkDB has official packages for Ubuntu, Centos, Debian, and OS X (both prebuilt and via Homebrew); current versions of RethinkDB use a JSON-based protocol rather than Protobufs; in addition to the official client drivers for Python, Ruby and JavaScript, we have community-supported drivers for a variety of languages including C#, Clojure, Dart, Go, Haskell, Java, Lua, Perl, PHP and Scala; RethinkDB has geospatial support; and while RethinkDB supports “upserts,” the insert command now uses a different syntax.

We received a lot of questions in past few days since our release. While my colleagues are busy expanding support for other Linux distros, squashing bugs, and improving the documentation), I thought I’d use this time to answer some of the most common questions we received.

How do I install RethinkDB on other Linux flavors?

Currently the only binaries we provide are for Ubuntu 64-bit 11.04 and above. While we are working on packaging for other Linux flavors, you can try building from source.

What’s the best method to install on OS X?

Update: Starting with version 1.3, [released mid December 2012][], there’s a pre-built package distribution Mac OS X . You can also install RethinkDB using Homebrew. For detailed instructions check out the install page.

Right now there are two options:

  1. installing the Ubuntu package in a virtual machine running Ubuntu 64-bit.
  2. using @RyanAmos’s vagrant-based setup: https://github.com/RyanAmos/rethinkdb-vagrant.

Because neither of these options is as easy as we would like it to be, nor pleasant, we decided to work on a native OS X port.

This question was asked by so many people that most probably I’ll fail to mention everyone: Ollivier Robert, Max Countryman, @seanhess. But you all helped us decide to work on the Mac OS X port now.

Is there a driver/library for X?

The first release included only 3 drivers: Javascript, Python, and Ruby. But the list of drivers we’ve been asked about keeps growing: Java, Erlang, C++, Go, PHP, Arc, Perl, C#/.NET, Coffescript, Dart, Scala.

We use protocol buffers between the client drivers and the server, so adding support for other languages should be easy with your help. Etienne Laurin has already been working on a Haskell client.

While writing our initial drivers we’ve realized that query_language.proto could be significantly improved, so in the next couple of weeks there will be some changes that will simplify writing client libraries. We also want to clearly document the process of creating new drivers to help contributors and speed development on other languages.

Are there any plans for an HTTP interface?

This question came from Edgardo Vega. The RethinkDB query language is so simple, expressive, and pleasant, that trying to make it available over HTTP would be quite difficult and a disservice to users.

If you are building an application that needs HTTP access to RethinkDB, we are sure that creating a RESTful interface that fits your needs would be a better solution than exposing the complete ReQL language over HTTP.

Does RethinkDB have support for geo/spatial?

Smart Mumbaikar was wondering if RethinkDB handles geo data.

Unfortunately there is currently no support for that. You could still insert geo data in RethinkDB’s JSON engine, but we know that without geospatial indexes this won’t be very useful.

Can RethinkDB do bulk inserts?

Sergio Tulentsev asked about bulk inserts. The way to do bulk inserts is by passing an array to the insert function. Here is how to do it in JavaScript:

r.table('marvel').insert([
	{ superhero: 'Wolverine', superpower: 'Adamantium' }, 
	{ superhero: 'Spiderman', superpower: 'spidy sense' }]).run()

Bulk inserts in Python and Ruby look exactly the same. Another way to get data into RethinkDB is by importing CSV files:

rethinkdb import --join localhost:29015 --table <DB_NAME.TABLE_NAME> --input-file<FILE>

Does RethinkDB support upserts?

Another question from Sergio Tulentsev. The first public release didn’t include support for upserts, but now it can be done by passing an extra flag to insert:

r.table('marvel').insert({ superhero: 'Iron Man', superpower: 'Arc Reactor' }, {upsert: true}).run()

When set to true, the new document from insert will overwrite the existing one.

Why doesn’t RethinkDB include Stargate SG-1 in their list of best TV shows?

Hilario Pérez Corona put us in a delicate position with this question on Twitter. I did a search against our commit logs and found no references to Stargate SG-1. Future updates will make sure to address this very serious omission on our side.

If you have any additional questions please reach out to us on Twitter, IRC, or our Google group.