Manipulating Databases

dbCreate

Create a database. A RethinkDB database is a collection of tables, similar to relational databases.

If successful, the operation returns a DDLResult {created=1}. If a database with the same name already exists the operation throws RethinkDBException.

Note: that you can only use alphanumeric characters and underscores for the database name.

Example:

DDLResult result = r.dbCreate("db").run(connection);

dbDrop

Drop a database. The database, all its tables, and corresponding data will be deleted.

If successful, the operation returns the object DDLResult {dropped=1}. If the specified database doesn’t exist a RethinkDBException is thrown.

Example: Drop a database named ‘superheroes’.

DDLResult result = r.dbDrop("db").run(connection);

dbList

List all database names in the system. The result is a list of strings.

Example:

List<String> result = r.dbList().run(connection);