Retrieving the Range of Data with a Cursor
Learn about KeyRange and how to use it with a cursor to retrieve data within a specific range.
In IndexedDB, a KeyRange
object represents a range of keys in an object store. It can retrieve a specific range of records from the object store.
How to create a KeyRange
?
There are several ways to create a KeyRange
object:
Using the
only()
methodUsing the
bound()
methodUsing the
lowerBound()
methodUsing the
upperBound()
method
Using the only
method
This method takes a single key as its argument and creates a KeyRange
object that represents a range that only includes that key.
Syntax
Get hands-on with 1200+ tech skills courses.