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 |
batch | integer | 100 | > 0 | Number of documents returned per batch |
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”Argument errors:
| Error Code | Error message | Cause |
|---|---|---|
ERR | Unknown subcommand: '<value>' | - |
ERR | invalid number of parameters | - |
ERR | Unknown session attribute: '<name>' | - |
ERR | Unknown reply type: '<value>' | - |
ERR | Unknown input type: '<value>' | - |
ERR | Unknown object id format: '<value>' | - |
ERR | 'batch' must be greater than 0 | - |
Examples
Section titled “Examples”List all attributes:
> SESSION.ATTRIBUTE LIST1# reply_type => bson2# input_type => bson3# batch => (integer) 1004# object_id_format => bytesSet the reply type to JSON:
> SESSION.ATTRIBUTE SET reply_type JSONOKSet batch:
> SESSION.ATTRIBUTE SET batch 50OKInvalid attribute name:
> SESSION.ATTRIBUTE SET unknown_attr value(error) ERR Unknown session attribute: 'unknown_attr'Invalid reply type value:
> SESSION.ATTRIBUTE SET reply_type xml(error) ERR Unknown reply type: 'xml'