Skip to content

SESSION.ATTRIBUTE

Views and modifies session-specific configuration attributes.

SESSION.ATTRIBUTE LIST
SESSION.ATTRIBUTE SET <attribute> <value>

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.

AttributeTypeDefaultValid ValuesDescription
reply_typeenumbsonbson, jsonData interchange format for responses
input_typeenumbsonbson, jsonData interchange format for inputs
limitinteger100> 0Maximum entries returned per query response
object_id_formatenumbytesbytes, hexEncoding format for object ID values in responses

All attribute names and enum values are case-insensitive.

ErrorCause
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 0limit was set to 0 or a negative number
ERR Invalid versionstamp format: <value>Invalid value for object_id_format
ERR invalid number of parametersSET called without both attribute and value
ERR Invalid session attribute: '<name>'The attribute name does not exist

List all attributes:

> SESSION.ATTRIBUTE LIST
1# reply_type => bson
2# input_type => bson
3# limit => (integer) 100
4# object_id_format => bytes

Set the reply type to JSON:

> SESSION.ATTRIBUTE SET reply_type JSON
OK

Set limit:

> SESSION.ATTRIBUTE SET limit 50
OK

Invalid 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