Search⌘ K
AI Features

Access the Available Index

Explore how to access and utilize existing indexes in IndexedDB object stores. Learn to retrieve data efficiently using methods such as get, getKey, getAll, and count by leveraging index references. This lesson shows practical code examples to help you perform operations on indexed data and understand their callback handling.

The index() method

We can use the index() method to access an existing index on an object store. This method is essential for performing efficient queries based on the indexed properties of the data stored in the database.

Syntax

The index() returns a reference to an existing index. Once we have this reference, we can use it to perform various operations, including searching for records that meet certain criteria.

let myIndex = objectStore.index(name);
Syntax of the index method

Here, name ...