Arguments
The key to of the stream.
 
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.
 
Prevent creating the stream if it does not exist.
Trim options for the stream.
type
'MAXLEN' | 'MINID'
required
The trim strategy:
MAXLEN: Trim based on the maximum number of entries 
MINID: Trim based on the minimum ID 
 The threshold value for trimming:
- For 
MAXLEN: The maximum number of entries to keep (number) 
- For 
MINID: The minimum ID to keep (string) 
 The comparison operator:
~: Approximate trimming (more efficient) 
=: Exact trimming 
 Limit how many entries will be trimmed at most
  
Response
The ID of the newly added entry.
 
const result = await redis.xadd("mystream", "*", { name: "John Doe", age: 30 });