Methods in WiredTiger take a configuration string to provide optional arguments and configure non-standard behaviors. These strings are simple comma-separated lists of "<key>=<value>"
pairs, and all have the same format:
[key['='value]][','[key['='value]]]*
For example, a configuration string is used when opening a connection to a database to specify if the database should be created and to set the cache size:
Configuration strings are also used to configure the table schema. For example, to create a table that uses C language strings for keys and values:
To handle more complex schema configuration, such as specifying multiple columns in a table, values are nested using parentheses. For example:
Values of type of "boolean" can be set to any of false
, true
, 0
or 1
. If no value is specified for a key, the value 1
is implied. For example, all of the following forms of the overwrite
configuration string are identical:
Configuration strings are processed in order from left to right, with later settings overriding earlier ones (unless multiple settings for a key are supported by the method).
Superfluous commas and whitespace in the configuration string are ignored (including at the beginning and end of the string), so it is always safe to combine two configuration strings by concatenating them with a comma in between.
Empty configuration strings may be represented in C or C++ by passing NULL
.
WiredTiger configuration strings are compatible with JavaScript Object Notation (JSON), and will accept additional formatting as follows:
'()'
, '[]'
or '{}'
':'
"key" = "value"
The result of this relaxed parsing is that applications may pass strings representing valid JSON objects wherever configuration strings are required.
For example, in Python, code might look as follows:
Because JSON compatibility allows colons to be used as key/value separators, WiredTiger URIs may require quoting. For example, the following WT_SESSION::checkpoint call specifies a set of URIs as checkpoint targets, using double-quote characters to keep the parser from treating the colon characters as JSON name/value separators: