Stream
XADD
Appends one or more new entries to a stream.
await redis.xadd(key, "*", { name: "John Doe", age: 30 });
Arguments
key
string
requiredThe key to of the stream.
id
string | *
requiredThe stream entry ID. If *
is passed, a new ID will be generated
automatically.
entries
Record<string, unknown>
requiredKey-value data to be appended to the stream.
options
nomkStream
boolean
Prevent creating the stream if it does not exist.
trim
type
'MAXLEN' | 'MINID'
requiredThe trim mode.
threshold
number | string
requiredThe threshold value for the trim mode.
comparison
~ | =
requiredThe 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.
Was this page helpful?
await redis.xadd(key, "*", { name: "John Doe", age: 30 });