db_create
ReQL command: db_create
Command syntax
r.db_create(db_name) → object
Description
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
: always1
. -
config_changes
: a list containing one object with two fields,old_val
andnew_val
:-
old_val
: alwaysnil
. -
new_val
: the database’s new config value.
-
If a database with the same name already exists, the command throws ReqlRuntimeError
.
Note: Only alphanumeric characters and underscores are valid for the database name.
Example: Create a database named ‘superheroes’.
r.db_create('superheroes').run(conn) { :config_changes => [ { :new_val => { :id => "e4689cfc-e903-4532-a0e6-2d6797a43f07", :name => "superheroes" }, :old_val => nil } ], :dbs_created => 1 }
Related commands
Get more help
Couldn't find what you were looking for?
- Ask a question on Stack Overflow
- Chat with us and our community on Slack
- Talk to the team on IRC on #rethinkdb@freenode.net — via Webchat
- Ping @rethinkdb on Twitter
- Post an issue on the documentation issue tracker on GitHub
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/ruby/db_create/