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
batchinteger100> 0Number of documents returned per batch
object_id_formatenumbytesbytes, hexEncoding format for object ID values in responses

All attribute names and enum values are case-insensitive.

Argument errors:

Error CodeError messageCause
ERRUnknown subcommand: '<value>'-
ERRinvalid number of parameters-
ERRUnknown session attribute: '<name>'-
ERRUnknown reply type: '<value>'-
ERRUnknown input type: '<value>'-
ERRUnknown object id format: '<value>'-
ERR'batch' must be greater than 0-

List all attributes:

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

Set the reply type to JSON:

> SESSION.ATTRIBUTE SET reply_type JSON
OK

Set batch:

> SESSION.ATTRIBUTE SET batch 50
OK

Invalid 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'