RethinkDB.Query.Database

ReQL methods for database manipulation operations.

All examples assume that use RethinkDB has been called.

Summary

db_create(arg)
db_create(arg, opts)

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

db_drop(arg)
db_drop(arg, opts)

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

db_list()

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

Functions

db_create(arg)

Specs:

db_create(arg, opts)

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

If successful, the command returns an object with two fields:

  • dbs_created: always 1.
  • config_changes: a list containing one object with two fields, old_val and new_val:
  • old_val: always null.
  • new_val: the database’s new config value.

If a database with the same name already exists, the command throws RqlRuntimeError.

Note: Only alphanumeric characters and underscores are valid for the database name.

db_drop(arg)

Specs:

db_drop(arg, opts)

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

If successful, the command returns an object with two fields:

  • dbs_dropped: always 1.
  • tables_dropped: the number of tables in the dropped database.
  • config_changes: a list containing one two-field object, old_val and new_val:
  • old_val: the database’s original config value.
  • new_val: always None.

If the given database does not exist, the command throws RqlRuntimeError.

db_list()

Specs:

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