await redis.xadd(key, "*", { name: "John Doe", age: 30 });

Arguments

key
string
required
The key to of the stream.
id
string | *
required
The stream entry ID. If * is passed, a new ID will be generated automatically.
entries
Record<string, unknown>
required
Key-value data to be appended to the stream.
options
nomkStream
boolean
Prevent creating the stream if it does not exist.
trim
type
'MAXLEN' | 'MINID'
required
The trim mode.
threshold
number | string
required
The threshold value for the trim mode.
comparison
~ | =
required
The comparison operator for the trim mode.
limit
number
Limit how many entries will be trimmed at most.

Response

The ID of the newly added entry.
await redis.xadd(key, "*", { name: "John Doe", age: 30 });