Skip to main content
Queries and mutations read with five verbs. Each names its result in its name, and each read joins the transaction’s read set.
bijection/orders.ts

get and has

ctx.get(point) returns the fact, or null when none is present. A missing fact is not a refusal. ctx.has(point) reads only whether the fact is present. It is a narrower read: a change to the fact’s fields does not wake a watch of it, and on a table with a presence label it reads at that lower label.

list

ctx.list reads all of a bounded selection, one that ends in .first(n). Passing an unbounded selection is a type error.

page

ctx.page reads one window of a selection of any size. Pass the previous page’s next as cursor; next is null after the last page.
A client pages a query that returns ctx.page(…) with usePages. A page of a change log also carries gone: true when the table’s history no longer holds the log since the requested version, so the walk ends and starts again from the log without .since. ctx.list of such a log refuses Expired.

count

ctx.count(selection) is the exact number of facts in a selection. It reads the selection, so a change to it wakes the reader. For counts and sums kept per group as facts are written, declare a total.

Ranked reads

A ranked selection is bounded, so ctx.list reads it. Each result is a hit.
On an erasable table, a supported single-term search at a pinned version uses the population at that cut and applies erasures visible to the reading transaction. If two documents matched and one is later erased, rerunning the same pinned search removes it and recomputes the survivor’s score from the remaining admitted corpus. Documents added after the cut stay outside that corpus.

Reading at another time or world

Valid time and worlds are part of the address:
A client sets them for a whole call with client.at(instant) and client.in(world). See Addresses.

What a reader sees

A read answers within the frame’s clearance. A fact above it is not present to the reader, and a sealed field is a Sealed<V> until ctx.open shows it. A change hidden above the reader’s label never wakes or conflicts with the reader. See Read rules.

Bounded reads

Every read is served by a declared index, and every read of many facts is bounded: by .first(n), by a page size, or by the transaction’s read budget. A range too large for the budget refuses Limit. Read the facts a function needs, not a table to search in code: declare the index that serves the question. A protected table’s indexes keep tokens of their fields at the store. There, page and count, and list of a .first(n), take a selection that fixes every field of an index by equality, the whole of a table with a minted key, any table’s facts in fact-id order (table.byId()), or a series across its keys by valid time. Read any other selection with ctx.list(selection.atMost(n)): the kernel opens at most n facts, and refuses Limit (reason SelectionOverBound) past them. An index with a reviewed store exposure stays clear and in order, and takes every read.