0
0
Redisquery~10 mins

Stream entry IDs in Redis - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a new entry to the stream with an auto-generated ID.

Redis
XADD mystream [1] name "Alice" age 30
Drag options to blanks, or click blank then click option'
A0-0
B1-0
CMAXLEN
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using a fixed ID like 0-0 or 1-0 instead of letting Redis generate it.
Using MAXLEN which is for trimming, not IDs.
2fill in blank
medium

Complete the code to read entries from the stream starting from the given ID.

Redis
XRANGE mystream [1] +
Drag options to blanks, or click blank then click option'
A+
B0-0
C-
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using * which is for auto-generated IDs, not for reading.
Using + which means the end of the stream.
3fill in blank
hard

Fix the error in the code to add an entry with a specific ID.

Redis
XADD mystream [1] name "Bob" age 25
Drag options to blanks, or click blank then click option'
A1-0
B*
C0-0
DMAXLEN
Attempts:
3 left
💡 Hint
Common Mistakes
Using * which auto-generates the ID instead of specifying one.
Using MAXLEN which is unrelated to IDs.
4fill in blank
hard

Fill both blanks to trim the stream to a maximum length and add a new entry with auto ID.

Redis
XADD mystream [1] [2] 10 * name "Carol" age 28
Drag options to blanks, or click blank then click option'
AMAXLEN
B*
C~
DMINID
Attempts:
3 left
💡 Hint
Common Mistakes
Using MINID instead of MAXLEN for trimming.
Omitting the approximate trimming symbol (~).
5fill in blank
hard

Fill both blanks to read entries from the stream starting after a given ID and limiting the count.

Redis
XREAD COUNT [1] STREAMS mystream [2]
Drag options to blanks, or click blank then click option'
A5
B0-0
C>
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0-0 which reads from the start, not new entries.
Using COUNT 5 instead of 10 as per instruction.