O'Reilly logo

Getting Started with RethinkDB by Gianluca Tiepolo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inserting data

Before inserting documents into the database, we must create a table to hold our data. We can do this using the tableCreate() command that takes the table name as an argument. Let's create a table called people by running the following query:

r.db('test').tableCreate('people')

This query assumes you have a database called test and creates the people table within this database. If the query is successful, you will get an output similar to this:

{ "config_changes":[ { "new_val":{ "db":"test", "durability":"hard", "id":"a29447ca-1587-4b8c-86db-a7b3d5198519", "name":"people", "primary_key":"id", "shards":[ { "primary_replica":"rethinkdb1", "replicas":[ "rethinkdb1" ] } ], "write_acks":"majority" }, "old_val":null } ], "tables_created":1 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required