IDBObjectStore

The IDBObjectStore interface of the IndexedDB API represents an object store in a database.

MDN Reference

Properties

Link copied to clipboard

The autoIncrement read-only property of the IDBObjectStore interface returns the value of the auto increment flag for this object store.

Link copied to clipboard

The indexNames read-only property of the IDBObjectStore interface returns a list of the names of indexes on objects in this object store.

Link copied to clipboard

The keyPath read-only property of the IDBObjectStore interface returns the key path of this object store.

Link copied to clipboard

The name property of the IDBObjectStore interface indicates the name of this object store.

Link copied to clipboard

The transaction read-only property of the IDBObjectStore interface returns the transaction object to which this object store belongs.

Functions

Link copied to clipboard
fun add(value: JsAny?, key: IDBValidKey = definedExternally): IDBRequest<IDBValidKey>

The add() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store.

Link copied to clipboard

The clear() method of the IDBObjectStore interface creates and immediately returns an IDBRequest object, and clears this object store in a separate thread.

Link copied to clipboard

fun count(query: IDBValidKey = definedExternally): IDBRequest<JsInt>

The count() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, returns the total number of records that match the provided key or IDBKeyRange.

Link copied to clipboard
fun createIndex(name: String, keyPath: ReadonlyArray<JsString>, options: IDBIndexParameters = definedExternally): IDBIndex

fun createIndex(name: String, keyPath: String, options: IDBIndexParameters = definedExternally): IDBIndex

The createIndex() method of the IDBObjectStore interface creates and returns a new IDBIndex object in the connected database.

Link copied to clipboard

The delete() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, deletes the specified record or records.

Link copied to clipboard
fun deleteIndex(name: String)

The deleteIndex() method of the IDBObjectStore interface destroys the index with the specified name in the connected database, used during a version upgrade.

Link copied to clipboard
fun get(query: IDBKeyRange): IDBRequest<*>

fun get(query: IDBValidKey): IDBRequest<*>

The get() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, returns the object selected by the specified key.

Link copied to clipboard
fun getAll(queryOrOptions: IDBKeyRange?, count: Int = definedExternally): IDBRequest<ReadonlyArray<*>>

fun getAll(queryOrOptions: IDBValidKey? = definedExternally, count: Int = definedExternally): IDBRequest<ReadonlyArray<*>>

The getAll() method of the IDBObjectStore interface 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.

Link copied to clipboard
fun getAllKeys(queryOrOptions: IDBKeyRange?, count: Int = definedExternally): IDBRequest<ReadonlyArray<IDBValidKey>>

fun getAllKeys(queryOrOptions: IDBValidKey? = definedExternally, count: Int = definedExternally): IDBRequest<ReadonlyArray<IDBValidKey>>

The getAllKeys() method of the IDBObjectStore interface 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.

Link copied to clipboard

The getKey() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, returns the key selected by the specified query.

Link copied to clipboard
fun index(name: String): IDBIndex

The index() method of the IDBObjectStore interface opens a named index in the current object store, after which it can be used to, for example, return a series of records sorted by that index using a cursor.

Link copied to clipboard
fun openCursor(query: IDBKeyRange?, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursorWithValue?>

fun openCursor(query: IDBValidKey? = definedExternally, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursorWithValue?>

The openCursor() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, returns a new IDBCursorWithValue object.

Link copied to clipboard
fun openKeyCursor(query: IDBKeyRange?, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursor?>

fun openKeyCursor(query: IDBValidKey? = definedExternally, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursor?>

The openKeyCursor() method of the IDBObjectStore interface returns an IDBRequest object whose result will be set to an IDBCursor that can be used to iterate through matching results.

Link copied to clipboard
fun put(value: JsAny?, key: IDBValidKey = definedExternally): IDBRequest<IDBValidKey>

The put() method of the IDBObjectStore interface updates a given record in a database, or inserts a new record if the given item does not already exist.