cursor . [source](#dom-idbcursor-source)

    Returns the [IDBObjectStore](#idbobjectstore) or [IDBIndex](#idbindex) the cursor was opened from.

    range . [direction](#dom-idbcursor-direction)

    Returns the (["next"](#dom-idbcursordirection-next), ["nextunique"](#dom-idbcursordirection-nextunique), ["prev"](#dom-idbcursordirection-prev) or ["prevunique"](#dom-idbcursordirection-prevunique)) of the cursor.

    cursor . [key](#dom-idbcursor-key)

    Returns the key of the cursor. Throws a “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) if the cursor is advancing or is finished.

    cursor . [primaryKey](#dom-idbcursor-primarykey)

    Returns the of the cursor. Throws a “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) if the cursor is advancing or is finished.

    The source attribute’s getter must return the source of this . This attribute never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not .

    The direction attribute’s getter must return the direction of the .

    The key attribute’s getter must return the result of running the steps to convert a key to a value with the cursor’s current . Note that if this property returns an object (e.g. a Date or ), it returns the same object instance every time it is inspected, until the cursor’s key is changed. This means that if the object is modified, those modifications will be seen by anyone inspecting the value of the cursor. However modifying such an object does not modify the contents of the database.

    The primaryKey attribute’s getter must return the result of running the steps to with the cursor’s current effective key. Note that if this property returns an object (e.g. a or Array), it returns the same object instance every time it is inspected, until the cursor’s is changed. This means that if the object is modified, those modifications will be seen by anyone inspecting the value of the cursor. However modifying such an object does not modify the contents of the database.

    The following methods advance a cursor. Once the cursor has advanced, a success event will be fired at the same [IDBRequest](#idbrequest) returned when the cursor was opened. The [result](#dom-idbrequest-result) will be the same cursor if a was in range, or undefined otherwise.

    If called while the cursor is already advancing, an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) will be thrown.

    The following methods throw a “[TransactionInactiveError](https://www.w3.org/TR/WebIDL-1/#transactioninactiveerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) if called when the transaction is not .

    cursor . [advance](#dom-idbcursor-advance)(count)

    Advances the cursor through the next count records in range.

    cursor . [continue](#dom-idbcursor-continue)()

    Advances the cursor to the next in range.

    cursor . [continue](#dom-idbcursor-continue)(key)

    Advances the cursor to the next record in range matching or after key.

    cursor . [continuePrimaryKey](#dom-idbcursor-continueprimarykey)(key, primaryKey)

    Advances the cursor to the next in range matching or after key and primaryKey. Throws an “[InvalidAccessError](https://www.w3.org/TR/WebIDL-1/#invalidaccesserror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) if the source is not an .

    The advance(count) method, when invoked, must run these steps:

    1. If count is 0 (zero), throw a .

    2. Let transaction be this cursor‘s .

    3. If transaction is not active, a “[TransactionInactiveError](https://www.w3.org/TR/WebIDL-1/#transactioninactiveerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    4. If the cursor’s source or has been deleted, throw an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    5. If this cursor’s is unset, indicating that the cursor is being iterated or has iterated past its end, throw an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    6. Unset the on the cursor.

    7. Let request be the request created when this was created.

    8. Unset the done flag on request.

    9. Run the steps to with the cursor’s source as source, the steps to as operation and request, using the current Realm as targetRealm, this and count.

    Calling this method more than once before new cursor data has been loaded - for example, calling [advance()](#dom-idbcursor-advance) twice from the same onsuccess handler - results in an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) being thrown on the second call because the cursor’s got value flag has been unset.

    The continue(key) method, when invoked, must run these steps:

    1. If transaction is not , throw a “[TransactionInactiveError](https://www.w3.org/TR/WebIDL-1/#transactioninactiveerror)“ .

    2. If the cursor’s or effective object store has been deleted, an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    3. If this cursor’s got value flag is unset, indicating that the cursor is being iterated or has iterated past its end, an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    4. If key is given, then:

      1. Let r be the result of running the steps to convert a value to a key with key. Rethrow any exceptions.

      2. If r is invalid, a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

      3. Let key be r.

      4. If key is less than or this cursor’s position and this cursor’s is ["next"](#dom-idbcursordirection-next) or ["nextunique"](#dom-idbcursordirection-nextunique), throw a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

      5. If key is or equal to this cursor’s and this cursor’s direction is ["prev"](#dom-idbcursordirection-prev) or ["prevunique"](#dom-idbcursordirection-prevunique), a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    5. Unset the got value flag on the cursor.

    6. Let request be the created when this cursor was created.

    7. Run the steps to with the cursor’s source as source, the steps to as operation and request, using the current Realm as targetRealm, this and key (if given).

    Calling this method more than once before new cursor data has been loaded - for example, calling [continue()](#dom-idbcursor-continue) twice from the same onsuccess handler - results in an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) being thrown on the second call because the cursor’s got value flag has been unset.

    The continuePrimaryKey(key, primaryKey) method, when invoked, must run these steps:

    1. Let transaction be this ‘s transaction.

    2. If transaction is not , throw a “[TransactionInactiveError](https://www.w3.org/TR/WebIDL-1/#transactioninactiveerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    3. If the cursor’s or effective object store has been deleted, an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    4. If this cursor’s source is not an throw an “[InvalidAccessError](https://www.w3.org/TR/WebIDL-1/#invalidaccesserror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    5. If this cursor’s is not ["next"](#dom-idbcursordirection-next) or ["prev"](#dom-idbcursordirection-prev), throw an “[InvalidAccessError](https://www.w3.org/TR/WebIDL-1/#invalidaccesserror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    6. If this cursor’s is unset, indicating that the cursor is being iterated or has iterated past its end, throw an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    7. Let r be the result of running the steps to with key. Rethrow any exceptions.

    8. If r is invalid, throw a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    9. Let key be r.

    10. Let r be the result of running the steps to with primaryKey. Rethrow any exceptions.

    11. If r is invalid, throw a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    12. Let primaryKey be r.

    13. If key is this cursor’s position and this cursor’s is ["next"](#dom-idbcursordirection-next), throw a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    14. If key is this cursor’s position and this cursor’s is ["prev"](#dom-idbcursordirection-prev), throw a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    15. If key is this cursor’s position and primaryKey is or equal to this cursor’s and this cursor’s direction is ["next"](#dom-idbcursordirection-next), a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    16. If key is equal to this cursor’s and primaryKey is greater than or this cursor’s object store position and this cursor’s is ["prev"](#dom-idbcursordirection-prev), throw a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)“ .

    17. Unset the on the cursor.

    18. Let request be the request created when this was created.

    19. Unset the done flag on request.

    20. Run the steps to with the cursor’s source as source, the steps to as operation and request, using the current Realm as targetRealm, this , key and primaryKey.

    Calling this method more than once before new cursor data has been loaded - for example, calling [continuePrimaryKey()](#dom-idbcursor-continueprimarykey) twice from the same onsuccess handler - results in an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) being thrown on the second call because the cursor’s got value flag has been unset.

    The following methods throw a “[ReadOnlyError](https://www.w3.org/TR/WebIDL-1/#readonlyerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) if called within a , and a “[TransactionInactiveError](https://www.w3.org/TR/WebIDL-1/#transactioninactiveerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) if called when the transaction is not .

    request = cursor . [update](#dom-idbcursor-update)(value)

    Updated the record pointed at by the cursor with a new value.

    Throws a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException) if the uses in-line keys and the would have changed.

    If successful, request’s [result](#dom-idbrequest-result) will be the record‘s .

    request = cursor . [delete](#dom-idbcursor-delete)()

    Delete the record pointed at by the cursor with a new value.

    If successful, request’s [result](#dom-idbrequest-result) will be undefined.

    The update(value) method, when invoked, must run these steps:

    1. If transaction is not , throw a “[TransactionInactiveError](https://www.w3.org/TR/WebIDL-1/#transactioninactiveerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    2. If transaction is a , throw a “[ReadOnlyError](https://www.w3.org/TR/WebIDL-1/#readonlyerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    3. If the cursor’s or effective object store has been deleted, an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    4. If this cursor’s got value flag is unset, indicating that the cursor is being iterated or has iterated past its end, an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    5. If this cursor’s key only flag is set, an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    6. Let targetRealm be a user-agent defined Realm.

    7. Let clone be a of value in targetRealm. Rethrow any exceptions.

      Why create a copy of the value? The value is serialized when stored. Treating it as a copy here allows other algorithms in this specification to treat it as an ECMAScript value, but implementations can optimize this if the difference in behavior is not observable.

    8. If the effective object store of this cursor uses , then:

      1. Let kpk be the result of running the steps to extract a key from a value using a key path with clone and the of the effective object store. Rethrow any exceptions.

      2. If kpk is failure, invalid, or not the cursor’s effective key, a “[DataError](https://www.w3.org/TR/WebIDL-1/#dataerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    9. Run the steps to asynchronously execute a request and return the [IDBRequest](#idbrequest) created by these steps. The steps are run with this as source and the steps to store a record into an object store as operation, using this cursor’s as store, the clone as value, this cursor’s effective key as key, and with the no-overwrite flag unset.

    A result of running the steps to is that if the record has been deleted since the cursor moved to it, a new record will be created.

    The delete() method, when invoked, must run these steps:

    1. Let transaction be this cursor‘s .

    2. If transaction is not active, a “[TransactionInactiveError](https://www.w3.org/TR/WebIDL-1/#transactioninactiveerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    3. If transaction is a read-only transaction, a “[ReadOnlyError](https://www.w3.org/TR/WebIDL-1/#readonlyerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    4. If the cursor’s source or has been deleted, throw an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    5. If this cursor’s is unset, indicating that the cursor is being iterated or has iterated past its end, throw an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    6. If this cursor’s is set, throw an “[InvalidStateError](https://www.w3.org/TR/WebIDL-1/#invalidstateerror)[DOMException](https://www.w3.org/TR/WebIDL-1/#idl-DOMException).

    7. Run the steps to and return the [IDBRequest](#idbrequest) created by these steps. The steps are run with this cursor as source and the steps to as operation, using this cursor’s effective object store and as store and key respectively.

    A cursor that has the unset implements the [IDBCursorWithValue](#idbcursorwithvalue) interface as well.

    1. [Exposed=(Window,Worker)]
    2. interface IDBCursorWithValue : {
    3. readonly attribute any value;

    cursor . [value](#dom-idbcursorwithvalue-value)

    Returns the ‘s current value.