Many operations in WiredTiger accept a string to configure options. These strings all have the same format:
[key['='value]][','[key['='value]]]*
That is, they are simple comma-separated lists of "<key>=<value>"
pairs. If the "=<value>"
part is omitted, the value of 1 is assumed.
To handle more complex configuration, such as specifying a schema, values may be nested lists using parentheses. For example:
schema=(keyfmt=S,valuefmt=S,columns=(name,notes))
Empty configuration strings may be represented in C or C++ by passing NULL
.
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.
Keys are processed in order from left to right, with later settings overriding earlier ones unless multiple settings for a key are permitted.
The parser for configuration strings 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:
Open a connection to a database, creating it if it does not exist and set a cache size of 10MB, then open a session in the database:
Create a table that uses C language strings for keys and values:
Walk a transactional cursor through the table: