The last time Hackerfall tried to access this page, it returned a not found error. A cached version of the page is below, or clickhereto continue anyway

Using with RethinkDB Changefeeds to Build a Reactive JavaScript Stack Scott Hasbrouck

RethinkDB is the latest major entrant NoSQL database. Having used it in production to build my current startup, it is in my opinion one of the best databases for a reactive web app. The key feature that makes it so powerful are changefeeds. These are essentially defined ReQL queries tied to an event listener (callbacks). Every time a document is changed, added, or removed that is selected by the query, the changefeed passes the updated document(s) to the event listener. If you're anything like me, I'm sure your mind is already spinning with the possibilities!

Meteor made use of MongoDB oplog tailing to push database changes up to the client (i.e. the client app did not need to regularly poll the backend for updates). Building on this idea, this is how I've used RethinkDB changefeeds to push database changes to the client of a WebSocket, thus, keeping client and server data in seamless sync. Let's see how this works.


Let's say we have a table in RethinkDB called Fruit, with the documents:

Continue reading on