Creating a Cursor for the Object Store
Learn to create a cursor for an object store.
We'll cover the following...
The openCursor()
method
The openCursor()
method is used to open a cursor across one of the object stores in an IndexedDB database. It allows us to iterate over the records in the store, searching for a specific key or range of keys.
Syntax
openCursor()openCursor(query)openCursor(query, direction)
Syntax of the openCursor() method
The openCursor()
method has two optional parameters that can be used to specify the cursor options:
query
: This parameter specifies the key or the to use for the cursor. If nothing is passed then the cursor will be opened for all the data in the object store.key range Range of keys from 1–5. direction
...