The
count(|query|) method steps are:
@@ -3636,6 +3682,7 @@ interface IDBIndex {
optional [EnforceRange] unsigned long count);
[NewObject] IDBRequest getAllKeys(optional any query,
optional [EnforceRange] unsigned long count);
+ [NewObject] IDBRequest getAllEntries(optional IDBGetAllEntriesOptions options = {});
[NewObject] IDBRequest count(optional any query);
[NewObject] IDBRequest openCursor(optional any query,
@@ -3784,6 +3831,13 @@ return [=/this=]'s [=index-handle/index=]'s [=index/unique flag=].
If successful, |request|'s {{IDBRequest/result}} will be an
[=ECMAScript/Array=] of the [=/keys=].
+
+ : |request| = |index| . {{IDBIndex/getAllEntries()|getAllEntries}}(|query| [, |count|])
+ ::
+ Retrieves the [=/keys=], [=/values=], and index [=/keys=] of [=object-store/records=] matching the given [=/key=] or [=key range=] in |query| (up to |count| if given).
+
+ If successful, |request|'s {{IDBRequest/result}} will be an [=ECMAScript/Array=], with each member being an [=ECMAScript/Array=] with [=/key=], [=/value=], and index [=/key=].
+
: |request| = |index| .
{{IDBIndex/count()|count}}(|query|)
::
@@ -3881,7 +3935,7 @@ The
getAll(|query|, |count|) method steps are:
[=/converting a value to a key range=] with |query|.
Rethrow any exceptions.
-1. Let |operation| be an algorithm to run [=retrieve multiple referenced values from an index=] with the [=ECMAScript/current Realm=], |index|, |range|, and |count| if given.
+1. Let |operation| be an algorithm to run [=retrieve multiple items from an index=] with the [=ECMAScript/current Realm=], |index|, |range|, "value", and |count| if given.
1. Return the result (an {{IDBRequest}}) of running [=asynchronously execute a request=] with [=/this=] and |operation|.
@@ -3889,7 +3943,7 @@ The
getAll(|query|, |count|) method steps are:
The |query| parameter can be a [=/key=] or [=/key range=] (an {{IDBKeyRange}})
-identifying the [=object-store/records=] to be retrieved. If null or not given,
+identifying the [=object-store/record=] values to be retrieved. If null or not given,
an [=unbounded key range=] is used. If |count| is specified and
there are more than |count| records in range, only the first |count|
will be retrieved.
@@ -3914,7 +3968,7 @@ The getAllKeys(|query|, |count|) method steps are
[=/converting a value to a key range=] with |query|.
Rethrow any exceptions.
-1. Let |operation| be an algorithm to run [=retrieve multiple values from an index=] with |index|, |range|, and |count| if given.
+1. Let |operation| be an algorithm to run [=retrieve multiple items from an index=] with the [=ECMAScript/current Realm=], |index|, |range|, "key", and |count| if given.
1. Return the result (an {{IDBRequest}}) of running [=asynchronously execute a request=] with [=/this=] and |operation|.
@@ -3929,6 +3983,37 @@ will be retrieved.
+
+
+The getAllEntries(|query|, |count|) method steps are:
+
+1. Let |transaction| be [=/this=]'s [=index-handle/transaction=].
+
+1. Let |index| be [=/this=]'s [=index-handle/index=].
+
+1. If |index| or |index|'s [=/object store=] has been deleted, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}.
+
+1. If |transaction|'s [=transaction/state=] is not [=transaction/active=], then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.
+
+1. Let |range| be the result of [=/converting a value to a key range=] with |query|. Rethrow any exceptions.
+
+1. Let |operation| be an algorithm to run [=retrieve multiple items from an index=] with the [=ECMAScript/current Realm=], |index|, |range|, "key+value+indexKey", and |count| if given.
+
+1. Return the result (an {{IDBRequest}}) of running [=asynchronously execute a request=] with [=/this=] and |operation|.
+
+
+
+
+The |query| parameter can be a [=/key=] or [=key range=] (an {{IDBKeyRange}}) identifying the [=object-store/records=] to be retrieved. If null or not given, an [=unbounded key range=] is used. If |count| is specified and there are more than |count| keys in range, only the first |count| will be retrieved.
+
+
+
+ 🚧
+ The {{IDBIndex/getAllEntries()}} method is new in this edition.
+ 🚧
+
+
+
The count(|query|) method steps are:
@@ -5267,7 +5352,7 @@ created [=/request=] belongs to is [=transaction/aborted=] using the steps to
1. [=/Assert=]: |transaction|'s [=transaction/state=] is [=transaction/active=].
-1. If |request| was not given, let |request| be a new [=/request=] with [=request/source=] as |source|.
+1. If |request| was not given, let |request| be a new [=/request=] with |source| as [=request/source=].
1. Add |request| to the end of |transaction|'s [=transaction/request list=].
@@ -5736,30 +5821,6 @@ To retrieve a value from an object store with
-
-
-To retrieve multiple values from an object
-store with |targetRealm|, |store|, |range| and optional |count|, run these steps:
-
-1. If |count| is not given or is 0 (zero), let |count| be infinity.
-
-1. Let |records| be a [=/list=] containing the first |count| [=object-store/records=]
- in |store|'s [=object-store/list of records=] whose [=/key=] is
- [=in=] |range|.
-
-1. Let |list| be an empty [=/list=].
-
-1. [=list/For each=] |record| of |records|:
-
- 1. Let |serialized| be |record|'s [=/value=].
- 1. Let |entry| be [=ECMAScript/!=] [$StructuredDeserialize$](|serialized|, |targetRealm|).
- 1. Append |entry| to |list|.
-
-1. Return |list| converted to a [=/sequence=]<{{any}}>
.
-
-
-
-
To
retrieve a key from an object store
@@ -5779,24 +5840,38 @@ with |store| and |range|, run these steps:
-To
retrieve multiple keys from an object store
-with |store|, |range| and optional |count|, run these steps:
+To
retrieve multiple items from an object store with |targetRealm|, |store|, |range|, |kind| and optional |count|, run these steps:
1. If |count| is not given or is 0 (zero), let |count| be infinity.
-1. Let |records| be a list containing the first |count| [=object-store/records=]
- in |store|'s [=object-store/list of records=] whose [=/key=] is
- [=in=] |range|.
+1. Let |records| be a list containing the first |count| [=object-store/records=] in |store|'s [=object-store/list of records=] whose [=/key=] is [=in=] |range|.
1. Let |list| be an empty [=/list=].
-1. [=list/For each=] |record| of |records|:
+1. [=list/For each=] |record| of |records|, switching on |kind|:
- 1. Let |entry| be the result of [=/converting a
- key to a value=] with |record|'s key.
- 1. Append |entry| to |list|.
+
+ : "key"
+ ::
+ 1. Let |key| be the result of [=/converting a key to a value=] with |record|'s key.
+ 1. [=list/Append=] |key| to |list|.
+
+ : "value"
+ ::
+ 1. Let |serialized| be |record|'s [=/value=].
+ 1. Let |value| be [=ECMAScript/!=] [$StructuredDeserialize$](|serialized|, |targetRealm|).
+ 1. [=list/Append=] |value| to |list|.
-1. Return |list| converted to a [=/sequence=]<{{any}}>
.
+ : "key+value"
+ ::
+ 1. Let |key| be the result of [=/converting a key to a value=] with |record|'s key.
+ 1. Let |serialized| be |record|'s [=/value=].
+ 1. Let |value| be [=ECMAScript/!=] [$StructuredDeserialize$](|serialized|, |targetRealm|).
+ 1. [=list/Append=] « |key|, |value| » to |list|.
+
+
+
+1. Return |list|.
@@ -5821,29 +5896,6 @@ with |targetRealm|, |index| and |range|, run these steps:
-
-
-
-To retrieve multiple referenced values from an
-index with |targetRealm|, |index|, |range| and optional |count|, run these steps:
-
-1. If |count| is not given or is 0 (zero), let |count| be infinity.
-
-1. Let |records| be a list containing the first |count| [=object-store/records=]
- in |index|'s [=index/list of records=] whose [=index/key=] is [=in=] |range|.
-
-1. Let |list| be an empty [=/list=].
-
-1. [=list/For each=] |record| of |records|:
-
- 1. Let |serialized| be |record|'s [=index/referenced value=].
- 1. Let |entry| be [=ECMAScript/!=] [$StructuredDeserialize$](|serialized|, |targetRealm|).
- 1. Append |entry| to |list|.
-
-1. Return |list| converted to a [=/sequence=]<{{any}}>
.
-
-
-
The [=index/values=] of an [=index/record=] in an index are the keys of
[=object-store/records=] in the [=index/referenced=] object store.
@@ -5867,26 +5919,46 @@ To retrieve a value from an index with
-To
retrieve multiple values from an index with
-|index|, |range| and optional |count|, run these steps:
+To
retrieve multiple items from an index with |targetRealm|, |index|, |range|, |kind| and optional |count|, run these steps:
1. If |count| is not given or is 0 (zero), let |count| be infinity.
-1. Let |records| be a list containing the first |count| [=index/records=] in
- |index|'s [=index/list of records=] whose [=index/key=] is [=in=] |range|.
+1. Let |records| be a list containing the first |count| [=object-store/records=] in |index|'s [=index/list of records=] whose [=index/key=] is [=in=] |range|.
1. Let |list| be an empty [=/list=].
-1. [=list/For each=] |record| of |records|:
+1. [=list/For each=] |record| of |records|, switching on |kind|:
- 1. Let |entry| be the result of [=/converting a
- key to a value=] with |record|'s value.
- 1. Append |entry| to |list|.
+
+ : "key"
+ ::
+ 1. Let |key| be the result of [=/converting a key to a value=] with |record|'s value.
+ 1. [=list/Append=] |key| to |list|.
-1. Return |list| converted to a [=/sequence=]<{{any}}>
.
+ : "value"
+ ::
+ 1. Let |serialized| be |record|'s [=index/referenced value=].
+ 1. Let |value| be [=ECMAScript/!=] [$StructuredDeserialize$](|serialized|, |targetRealm|).
+ 1. [=list/Append=] |value| to |list|.
+
+ : "key+value+indexKey"
+ ::
+ 1. Let |key| be the result of [=/converting a key to a value=] with |record|'s value.
+ 1. Let |indexKey| be the result of [=/converting a key to a value=] with |record|'s key.
+ 1. Let |serialized| be |record|'s [=index/referenced value=].
+ 1. Let |value| be [=ECMAScript/!=] [$StructuredDeserialize$](|serialized|, |targetRealm|).
+ 1. [=list/Append=] « |key|, |value|, |indexKey| » to |list|.
+
+
+
+1. Return |list|.
+
+ The [=index/values=] of a [=index/record=] in an index are the keys of [=object-store/records=] in the [=index/referenced=] object store.
+
+
## Object store deletion operation ## {#object-store-deletion-operation}
@@ -6800,6 +6872,7 @@ For the revision history of the second edition, see [that document's Revision Hi
* Specified [[#transaction-scheduling]] more precisely and disallow starting read/write transactions while read-only transactions with overlapping scope are running. ([Issue #253](https://github.com/w3c/IndexedDB/issues/253))
* Added Accessibility considerations section. ([Issue #327](https://github.com/w3c/IndexedDB/issues/327))
* Used [[infra]]'s list sorting definition. ([Issue #346](https://github.com/w3c/IndexedDB/issues/346))
+* Added object store {{IDBObjectStore/getAllEntries()}} and index {{IDBIndex/getAllEntries()}} methods. ([Issue #206](https://github.com/w3c/IndexedDB/issues/206))
# Acknowledgements # {#acknowledgements}