IDBIndex

@native @JSGlobal @JSType

The 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.

You can retrieve records in an object store through their keys or by using an index (cursors provide a third way: see IDBCursor). An index lets you look up records in an object store using properties of the values in the object stores records.

The index is a persistent key-value storage where the value part of its records is the key part of a record in the referenced object store. The records in an index are automatically populated whenever records in the referenced object store are inserted, updated, or deleted. Each record in an index can point to only one record in its referenced object store, but several indexes can reference the same object store. When the object store changes, all indexes that refers to the object store are automatically updated.

class Object
trait Any
class Object
trait Matchable
class Any

Value members

Concrete methods

The name of the object store referenced by this index.

The name of the object store referenced by this index.

def unique: Boolean

If true, this index does not allow duplicate values for a key.

If true, this index does not allow duplicate values for a key.

Inherited methods

def count(query: IDBKey | IDBKeyRange): IDBRequest[IDBIndex, Double]
Inherited from:
IDBStoreLike

Returns an IDBRequest object, and, in a separate thread, returns the object store selected by the specified key. This is for retrieving specific records from an object store.

Returns an IDBRequest object, and, in a separate thread, returns the object store selected by the specified key. This is for retrieving specific records from an object store.

Note: This method produces the same result for: a) a record that doesn't exist in the database and b) a record that has an undefined value. To tell these situations apart, call the openCursor method with the same key. That method provides a cursor if the record exists, and no cursor if it does not.

Inherited from:
IDBStoreLike
def getAll(query: UndefOr[IDBKeyRange | IDBKey], count: UndefOr[Double]): IDBRequest[IDBIndex, Array[IDBValue]]

Returns an IDBRequest object containing all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

Returns an IDBRequest object containing all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

If a value is successfully found, then a structured clone of it is created and set as the result of the request object.

This method produces the same result for:

  • a record that doesn't exist in the database
  • a record that has an undefined value

To tell these situations apart, you either call

  • the openCursor method with the same key. That method provides a cursor if the record exists, and no cursor if it does not.
  • the count method with the same key, which will return 1 if the row exists and 0 if it doesn't.
Inherited from:
IDBStoreLike
def getAllKeys(query: UndefOr[IDBKeyRange | IDBKey], count: UndefOr[Double]): IDBRequest[IDBIndex, Array[IDBKey]]

Returns an IDBRequest object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

Returns an IDBRequest object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

If a value is successfully found, then a structured clone of it is created and set as the result of the request object.

This method produces the same result for:

  • a record that doesn't exist in the database
  • a record that has an undefined value

To tell these situations apart, you need to call the openCursor method with the same key. That method provides a cursor if the record exists, and no cursor if it does not.

Inherited from:
IDBStoreLike
def getKey(key: IDBKey): IDBRequest[IDBIndex, UndefOr[IDBKey]]

Returns an IDBRequest object, and, in a separate thread, returns the key selected by the specified query. This is for retrieving specific records from an object store.

Returns an IDBRequest object, and, in a separate thread, returns the key selected by the specified query. This is for retrieving specific records from an object store.

Inherited from:
IDBStoreLike
def hasOwnProperty(v: String): Boolean
Inherited from:
Object
def isPrototypeOf(v: Object): Boolean
Inherited from:
Object

The key path of this object store. If this attribute is null, the application must provide a key for each modification operation.

The key path of this object store. If this attribute is null, the application must provide a key for each modification operation.

Inherited from:
IDBStoreLike
def name: String
Inherited from:
IDBStoreLike

The method sets the position of the cursor to the appropriate record, based on the specified direction.

The method sets the position of the cursor to the appropriate record, based on the specified direction.

Returns:

IDBRequest with the target value being a new cursor or null.

Inherited from:
IDBStoreLike

The method sets the position of the cursor to the appropriate key, based on the specified direction.

The method sets the position of the cursor to the appropriate key, based on the specified direction.

Returns:

IDBRequest with the target value being a new cursor or null.

Inherited from:
IDBStoreLike
def propertyIsEnumerable(v: String): Boolean
Inherited from:
Object
def toLocaleString(): String
Inherited from:
Object
def valueOf(): Any
Inherited from:
Object

Concrete fields

val multiEntry: Boolean

Returns a boolean value that affects how the index behaves when the result of evaluating the index's key path yields an array.

Returns a boolean value that affects how the index behaves when the result of evaluating the index's key path yields an array.

This is decided when the index is created, using the IDBObjectStore.createIndex method. This method takes an optional options parameter whose multiEntry property is set to true/false.