> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reading

> The five reads: get, has, list, page and count, over points and selections.

Queries and mutations read with five verbs. Each names its result in its
name, and each read joins the transaction's read set.

| Verb | Takes | Returns |
| - | - | - |
| `ctx.get(point)` | A point, a task or a total | `Fact \| null` |
| `ctx.has(point)` | A point | `boolean`: presence only |
| `ctx.list(selection.first(n))` | A bounded selection | `Fact[]` |
| `ctx.page(selection, { size, cursor })` | Any selection | `{ facts, next }` |
| `ctx.count(selection)` | Any selection | `number` |

```ts bijection/orders.ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { query, role, t } from "@bijectionhq/bijection";
import { orders } from "./tables";

// orders: index [["customer", "placed"]]

export const details = query({ allow: [role.signedIn], args: { order: t.key(orders) } }, (ctx, { order }) =>
  ctx.get(orders(order)),
);

export const recent = query({ allow: [role.signedIn], args: { customer: t.string } }, (ctx, { customer }) =>
  ctx.list(orders.where({ customer }).by("placed").descending().first(20)),
);

export const orderCount = query({ allow: [role.signedIn], args: { customer: t.string } }, (ctx, { customer }) =>
  ctx.count(orders.where({ customer })),
);
```

## `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](https://docs.bijection.com/database/capabilities.md#presence) it reads at that lower
label.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
if (await ctx.has(customers({ email }))) ctx.refuse("EmailTaken", "That email already has an account.");
```

## `list`

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

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const top = await ctx.list(products.where({ category }).by("rank").first(10));
```

## `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.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
export const orderPages = query(
  { allow: [role.signedIn], args: { customer: t.string, cursor: t.cursor } },
  (ctx, { customer, cursor }) =>
    ctx.page(orders.where({ customer }).by("placed").descending(), { size: 50, cursor }),
);
```

A client pages a query that returns `ctx.page(…)` with
[`usePages`](https://docs.bijection.com/clients/react). 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](https://docs.bijection.com/database/capabilities.md#totals).

## Ranked reads

A ranked selection is bounded, so `ctx.list` reads it. Each result is a hit.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const hits = await ctx.list(articles.search("textBody", text).first(10));
// [{ fact, score }, …]
```

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:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const then = await ctx.get(tariffs(sku).at(Temporal.Instant.from("2026-10-15T00:00:00Z")));
const before = await ctx.get(orders(order).in(version));
```

A client sets them for a whole call with `client.at(instant)` and
`client.in(world)`. See [Addresses](https://docs.bijection.com/database/addresses.md).

## 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](https://docs.bijection.com/access/labels.md).

## 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](https://docs.bijection.com/database/protected-tables.md)'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()`](https://docs.bijection.com/database/protected-tables#walk-every-fact-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](https://docs.bijection.com/database/protected-tables.md#expose-an-order-to-the-store) stays clear
and in order, and takes every read.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.