Adding my solution to a problem from the RethinkDB blog.