Key.all()
Signature
Key.all() => Set<Key>
Key.all(range: { from: Any } | { to: Any } | { from: Any, to: Any }) => Set<Key>
Description
Gets a Set containing all keys,
represented as Key documents,
for the database. To limit the returned Set, you can provide an optional range.
If Key.all() is the last value in a query, the first page of the
Set is returned. See Pagination.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
range |
|
Specifies a range of The Set only includes documents in this range (inclusive). Omit If a range is omitted, all |
Range parameters
| Name | Type | Required | Description |
|---|---|---|---|
|
Beginning of the range (inclusive). Must be an
|
||
|
End of the range (inclusive). Must be an
|
Return value
| Type | Description |
|---|---|
Set of The Set is empty if:
|
Examples
Range examples
-
Get all keys for the database:
Key.all(){ data: [ { id: "111", coll: Key, ts: Time("2099-07-19T20:53:15.250Z"), role: "admin", data: { desc: "Admin key for prod app database" } }, { id: "222", coll: Key, ts: Time("2099-07-19T20:53:15.250Z"), role: "server", data: { desc: "Server key for prod app database" } }, { id: "333", coll: Key, ts: Time("2099-07-19T20:53:15.250Z"), role: "server-readonly", data: { desc: "Server-readonly key for prod app database" } } ] } -
Get a Set of
Keydocuments from ID111(inclusive) to ID222(inclusive):Key.all({ from: Key.byId("111"), to: Key.byId("222") }){ data: [ { id: "111", coll: Key, ts: Time("2099-07-19T20:53:15.250Z"), role: "admin", data: { desc: "Admin key for prod app database" } }, { id: "222", coll: Key, ts: Time("2099-07-19T20:53:15.250Z"), role: "server", data: { desc: "Server key for prod app database" } } ] } -
Get a Set of keys up to ID
222(inclusive):Key.all({ to: Key.byId("222") }){ data: [ { id: "111", coll: Key, ts: Time("2099-07-19T20:53:15.250Z"), role: "admin", data: { desc: "Admin key for prod app database" } }, { id: "222", coll: Key, ts: Time("2099-07-19T20:53:15.250Z"), role: "server", data: { desc: "Server key for prod app database" } } ] }