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
Specs:
- db_create(RethinkDB.Query.reql_string) :: RethinkDB.Query.t
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.
Specs:
- db_drop(RethinkDB.Query.reql_string) :: RethinkDB.Query.t
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.
Specs:
- db_list :: RethinkDB.Query.t
List all database names in the system. The result is a list of strings.