Join us online - 19th of November
Save your spot
For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface IDBIndex

IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data.

MDN Reference

interface IDBIndex {
    keyPath: string | string[];
    multiEntry: boolean;
    name: string;
    objectStore: IDBObjectStore;
    unique: boolean;
    count(query?: IDBValidKey | IDBKeyRange): IDBRequest<number>;
    get(query: IDBValidKey | IDBKeyRange): IDBRequest<any>;
    getAll(
        queryOrOptions?: IDBValidKey | IDBKeyRange | null,
        count?: number,
    ): IDBRequest<any[]>;
    getAllKeys(
        queryOrOptions?: IDBValidKey | IDBKeyRange | null,
        count?: number,
    ): IDBRequest<IDBValidKey[]>;
    getKey(
        query: IDBValidKey | IDBKeyRange,
    ): IDBRequest<IDBValidKey | undefined>;
    openCursor(
        query?: IDBValidKey | IDBKeyRange | null,
        direction?: IDBCursorDirection,
    ): IDBRequest<IDBCursorWithValue | null>;
    openKeyCursor(
        query?: IDBValidKey | IDBKeyRange | null,
        direction?: IDBCursorDirection,
    ): IDBRequest<IDBCursor | null>;
}
Index
keyPath: string | string[]

The keyPath property of the IDBIndex interface returns the key path of the current index. If null, this index is not auto-populated.

MDN Reference

multiEntry: boolean

The multiEntry read-only property of the IDBIndex interface returns a boolean value that affects how the index behaves when the result of evaluating the index's key path yields an array.

MDN Reference

name: string

The name property of the IDBIndex interface contains a string which names the index.

MDN Reference

objectStore: IDBObjectStore

The objectStore property of the IDBIndex interface returns the object store referenced by the current index.

MDN Reference

unique: boolean

The unique read-only property returns a boolean that states whether the index allows duplicate keys.

MDN Reference

  • The get() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is set to an IDBKeyRange.

    MDN Reference

    Parameters

    Returns IDBRequest<any>

Was this helpful?