| layout | api-command | ||||
|---|---|---|---|---|---|
| language | JavaScript | ||||
| permalink | api/javascript/table_drop/ | ||||
| command | tableDrop | ||||
| io |
|
||||
| related_commands |
|
Command syntax
{% apibody %} db.tableDrop(tableName) → object {% endapibody %}
Description
Drop a table from a database. The table and all its data will be deleted.
If successful, the command returns an object with two fields:
tables_dropped: always1.config_changes: a list containing one two-field object,old_valandnew_val:old_val: the dropped table's config value.new_val: alwaysnull.
If the given table does not exist in the database, the command throws ReqlRuntimeError.
Example: Drop a table named 'dc_universe'.
> r.db('test').tableDrop('dc_universe').run(conn, callback); // Result passed to callback { "config_changes": [ { "old_val": { "db": "test", "durability": "hard", "id": "20ea60d4-3b76-4817-8828-98a236df0297", "name": "dc_universe", "primary_key": "id", "shards": [ { "primary_replica": "rethinkdb_srv1", "replicas": [ "rethinkdb_srv1", "rethinkdb_srv2" ] } ], "write_acks": "majority" }, "new_val": null } ], "tables_dropped": 1 }