Skip to content

Latest commit

 

History

History
63 lines (52 loc) · 1.58 KB

config.md

File metadata and controls

63 lines (52 loc) · 1.58 KB
layout api-command
language JavaScript
permalink api/javascript/config/
command config
io
table
singleSelection
database
singleSelection

Command syntax

{% apibody %} table.config() → selection<object> database.config() → selection<object> {% endapibody %}

Description

Query (read and/or update) the configurations for individual tables or databases.

The config command is a shorthand way to access the table_config or db_config System tables. It will return the single row from the system that corresponds to the database or table configuration, as if get had been called on the system table with the UUID of the database or table in question.

Example: Get the configuration for the users table.

> r.table('users').config().run(conn, callback);

Example return:

{
    "id": "31c92680-f70c-4a4b-a49e-b238eb12c023",
    "name": "users",
    "db": "superstuff",
    "primary_key": "id",
    "shards": [
        {
            "primary_replica": "a", 
            "replicas": ["a", "b"],
            "nonvoting_replicas": []
        },
        {
            "primary_replica": "d",
            "replicas": ["c", "d"],
            "nonvoting_replicas": []
        }
    ],
    "indexes": [],
    "write_acks": "majority",
    "durability": "hard"
}

Example: Change the write acknowledgement requirement of the users table.

> r.table('users').config().update({write_acks: 'single'}).run(conn, callback);