SESSION.ATTRIBUTE
Views and modifies session-specific configuration attributes.
Syntax
Section titled “Syntax”SESSION.ATTRIBUTE LISTSESSION.ATTRIBUTE SET <attribute> <value>Subcommands
Section titled “Subcommands”Returns all session attributes with their current values.
In RESP3 the response is a map; in RESP2 it is a flat array of alternating key-value pairs.
Sets a single session attribute to the given value. Returns OK on success.
Attributes
Section titled “Attributes”| Attribute | Type | Default | Valid Values | Description |
|---|---|---|---|---|
reply_type | enum | bson | bson, json | Data interchange format for responses |
input_type | enum | bson | bson, json | Data interchange format for inputs |
limit | integer | 100 | > 0 | Maximum entries returned per query response |
object_id_format | enum | bytes | bytes, hex | Encoding format for object ID values in responses |
All attribute names and enum values are case-insensitive.
Errors
Section titled “Errors”| Error | Cause |
|---|---|
ERR Invalid subcommand status: <value> | The subcommand is neither LIST nor SET |
ERR Invalid reply type: <value> | Invalid value for reply_type |
ERR Invalid input type: <value> | Invalid value for input_type |
ERR 'limit' must be greater than 0 | limit was set to 0 or a negative number |
ERR Invalid versionstamp format: <value> | Invalid value for object_id_format |
ERR invalid number of parameters | SET called without both attribute and value |
ERR Invalid session attribute: '<name>' | The attribute name does not exist |
Examples
Section titled “Examples”List all attributes:
> SESSION.ATTRIBUTE LIST1# reply_type => bson2# input_type => bson3# limit => (integer) 1004# object_id_format => bytesSet the reply type to JSON:
> SESSION.ATTRIBUTE SET reply_type JSONOKSet limit:
> SESSION.ATTRIBUTE SET limit 50OKInvalid attribute name:
> SESSION.ATTRIBUTE SET unknown_attr value(error) ERR Invalid session attribute: 'unknown_attr'Invalid reply type value:
> SESSION.ATTRIBUTE SET reply_type xml(error) ERR Invalid reply type: xml