Previous Next JavaScript must be enabled to correctly display this content

## put

Encapsulates commands that put key/value pairs to the store or put rows to a table. The subcommands are as follows:

- put kv

- put table

### put kv

    put kv -key <keyString> -value <valueString> [-file]
        [-hex] [-if-absent] [-if-present]

Put the specified key/value pair into the store. The following arguments apply to the put command:

- `-key<keyString>`

  Specifies the name of the key to be put into the store. Key can be composed of both major and minor key paths, or a major key path only. The <keyString> format is: "major-key-path/-/minor-key-path".

  For example, a key containing major and minor key paths:

      kv-> put kv -key /Smith/Bob/-/email -value
      "{\"id\": 1,\"email\":\"bob.smith@example.com\"}"

  For example, a key containing only a major key path:

      kv-> put kv -key /Smith/Bob -value"{\"name\":
       \"bob.smith\", \"age\": 20, \"phone\":\"408 555 5555\", \"email\":
       \"bob.smith@example.com\"}"

- `-value <valueString>`

  If -file is not specified, the <valueString> is treated as a raw bytes array.

  For example:

      kv-> put kv -key /Smith/Bob/-/phonenumber -value "408 555 5555"

  Note:

  The mapping of the raw arrays to data structures (serialization and deserialization) is left entirely to the application.

- `-file`

  Indicates that the value is obtained from a file. The file to use is identified by the value parameter.

  For example:

      kv-> put kv -key /Smith/Bob -value ./smith-bob-info.txt
       -file

- `-hex`

  Indicates that the value is a BinHex encoded byte value with base64 encoding.

- `-if-absent`

  Indicates that a key/value pair is `put` only if no value for the given key is present.

- `-if-present`

  Indicates that a key/value pair is `put` only if a value for the given key is present.

### put table

    kv-> put table -name table_name [if-absent | -if-present ]
        [-json string] [-file file_name] [-exact] [-update]

Puts one or more rows into the named table.

- `-name`

  Specifies a table name, which can identify different types of tables:

  - `table_name` – The table is a top level table created in the default namespace, `sysdefault`. The default `sysdefault:` namespace prefix is not required.
  - `table_name.child_name` – The table is a child table. Always precede a `child_name` table with its parent `table_name`, followed by a period (.) separator.
  - `namespace_name:table_name` – The table was created in the namespace you specify. Always precede `table_name` with its `namespace_name`, followed by a colon (:).
  - `namespace_name:table_name.child_name` – The table is a child table of a parent table created in a namespace. Specify `child_name` by preceding it with both `namespace_name:` and its parent `table_name`, , followed by a period (.) separator.

- `-if-absent`

  Indicates to put a row only if the row does not exist.

- `-if-present`

  Indicates to put a row only if the row already exists.

- `-json`

  Indicates that the value is a JSON string.

- `-file`

  Use to load a file of JSON strings.

- `-exact`

  Indicates that the input JSON string or file must contain values for all columns in the table and cannot contain extraneous fields.

- `-update`

  Can be used to partially update the existing record.