On the api documentation page rethinkdb.com/api/javascript I can only find commands to create, drop and list databases.
But how I can I rename a database in RethinkDB?
On the api documentation page rethinkdb.com/api/javascript I can only find commands to create, drop and list databases.
But how I can I rename a database in RethinkDB?
You basically have two options:
1. Update the name using the .config
method
You can also update the name using the .config
method every database and tables has. This would look something like this:
r
.db("db_name")
.config()
.update({name: "new_db_name"})
2. Update the db_config
table
You can also execute a query on the db_config
table and just do an update on the db you want to change. This would look something like this:
r
.db('rethinkdb')
.table('db_config')
.filter({ name: 'old_db_name' })
.update({ name: 'new_table_name'})
r.db('rethinkdb').table('table_config').filter({name: 'old_table_name'}).update({name: 'new_table_name'})
–
Zing © 2022 - 2024 — McMap. All rights reserved.