0
0
Redisquery~10 mins

XRANGE and XREVRANGE 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 get all entries from the stream 'mystream' starting from the beginning.

Redis
XRANGE mystream [1] +
Drag options to blanks, or click blank then click option'
A0
B-
C1
D$
Attempts:
3 left
💡 Hint
Common Mistakes
Using '0' instead of '-' as the start ID.
Using '$' which means the latest entry, not the start.
2fill in blank
medium

Complete the code to get the last 5 entries from the stream 'mystream' in reverse order.

Redis
XREVRANGE mystream + [1] COUNT 5
Drag options to blanks, or click blank then click option'
A-
B0
C1
D$
Attempts:
3 left
💡 Hint
Common Mistakes
Using '0' which is not a valid stream ID.
Using '$' which is the latest entry, not the earliest.
3fill in blank
hard

Fix the error in the command to get entries from 'mystream' starting at ID '1609459200000-0'.

Redis
XRANGE mystream [1] +
Drag options to blanks, or click blank then click option'
A'1609459200000-0'
B1609459200000_0
C1609459200000-0
D1609459200000
Attempts:
3 left
💡 Hint
Common Mistakes
Adding quotes around the ID.
Replacing dash with underscore.
Using incomplete ID without sequence number.
4fill in blank
hard

Fill both blanks to get entries from 'mystream' between IDs '1609459200000-0' and '1609459300000-0'.

Redis
XRANGE mystream [1] [2]
Drag options to blanks, or click blank then click option'
A1609459200000-0
B1609459300000-0
C-
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping start and end IDs.
Using '-' or '+' instead of actual IDs.
5fill in blank
hard

Fill all three blanks to get the last 3 entries from 'mystream' in reverse order starting from the latest entry.

Redis
XREVRANGE mystream [1] [2] COUNT [3]
Drag options to blanks, or click blank then click option'
A+
B-
C3
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong start or end IDs.
Using COUNT larger than needed.