> Fetch the index of the TinyStore docs, every page as markdown, at https://tinyshed.org/tinystore/llms.txt

# TinyStore 0.13.1

TinyStore 0.13.1 came out on 27 November 2026. It finishes what 0.13.0
started: a request or an answer of an SDK is no longer held to 2 MiB, a
mirror takes its list in parts, a group of `store.search` pages past its
first hundred hits, and a document gets words of its own. Nothing a program
writes against 0.13.0 changes meaning.

- **The wire**
  - [Past 2 MiB](#past-2-mib): a request or an answer up to 64 MiB, in one call.
- **SQL**
  - [A mirror's list in parts](#a-mirrors-list-in-parts): `begin`, `add`, `commit`.
  - [Marks in seconds](#marks-in-seconds): a deleted or gone column in the unit of your schema.
- **Search**
  - [Aliases](#aliases): a word that stands for a field in one document.
  - [A page of a group](#a-page-of-a-group): `offset` and `limit` in `store.search`.
  - [A thousand values in a filter](#a-thousand-values-in-a-filter): where a hundred stopped.
- **Metrics**
  - [Compare each group](#compare-each-group): `compareGroups`, a page of hosts at a time.
  - [Fill in pages](#fill-in-pages): `fill` with `limit`, a year of minutes.
- **Jobs**
  - [How far back](#how-far-back): `aheadAtLeast` past 10,000.
- **KV and locks**
  - [Encrypted once](#encrypted-once): a cache's answers sealed with the store's key.
  - [A breaker's failures](#a-breakers-failures): how many holds failed in a row.
- [Fixes](#fixes)

## Past 2 MiB

An SDK sent each request and read each answer as one frame of 2 MiB at
most, the same in a server and in a store embedded in the program's own
process. A list, a document or an answer past it failed with `limit`, however
much memory the program had. Now a message past one frame travels in pieces
and arrives whole, up to 64 MiB, so a mirror's scope of 20,000 rows or an
exporter's text of 30,000 series is one call. Nothing changes at the call
site.

- The engine sees one request: a write of many pieces still commits once,
  or not at all (contract WIRE-13).
- A client and a server agree on it when they connect. Against a server of
  0.13.0 or older a message is still 2 MiB, and a mirror's `replace` past it
  goes as a run, below.
- What waits to be joined counts toward a connection's memory, so a server
  holds a bounded amount of pieces for each client.

## A mirror's list in parts

`replace` must see the whole scope to know what is gone, so two calls with
half the list each marked the first half gone. A run takes the list in parts
and decides what is gone only at `commit`
([A list in parts](https://tinyshed.org/tinystore/docs/guides/sql/mirror.md#a-list-in-parts)):

```ts
const run = works.begin({ course_id: 1 })
for await (const page of pages) await run.add(page)
const diff = await run.commit() // gone: what no page named
```

```python
async with works.begin({"course_id": 1}) as run:
    async for page in pages:
        await run.add(page)
    diff = await run.commit()
```

```go
run := works.Begin(map[string]any{"course_id": 1})
defer run.Close(ctx)
for _, page := range pages {
	err = run.Add(ctx, page)
}
diff, err := run.Commit(ctx)
```

```rust
let run = works.begin(&[("course_id", 1)])?;
for page in &pages {
    run.add(page)?;
}
let diff = run.commit()?;
```

- The parts wait in a temporary table of the database's writer, not in the
  program's memory and not in the file. `commit` writes the difference in
  one commit, as one `replace` of all the rows would (contract SQL-26).
- A run never committed writes nothing: closed, idle for five minutes, its
  connection lost or its store closed.

## Marks in seconds

A table's deleted column and a mirror's gone column were marked in Unix
milliseconds. A schema that keeps its times in seconds, as SQLite's
`unixepoch()` does, now names the unit
([Seconds or milliseconds](https://tinyshed.org/tinystore/docs/guides/sql/deleted-and-versions.md#seconds-or-milliseconds)):

```ts
const tasks = db.table<Task>('tasks', { deleted: { column: 'deleted_at', unit: 's' } })
```

```python
tasks = db.table("tasks", Task, deleted=sql.Mark("deleted_at", unit="s"))
```

```go
tasks := sqldb.OpenTable[Task](db, "tasks", sqldb.Deleted("deleted_at", sqldb.Seconds))
```

```rust
let tasks = db.table::<Task>("tasks").deleted(sql::Mark::seconds("deleted_at"));
```

A column name alone still means milliseconds. The mark's time now comes from
the store's clock in every language, so a store on a test clock marks rows
with the time the test set (contract SQL-25).

## Aliases

Some short forms mean one thing in one document and another in the next:
«тп» is a dozen courses. An alias belongs to the document, names a field,
and stands for that field's whole text in this document alone
([Aliases](https://tinyshed.org/tinystore/docs/guides/search/synonyms.md#a-word-for-one-document-aliases)):

```ts
await catalog.set('c-7', { name: 'Теория принятия решений' }, { aliases: { тп: 'name' } })
const { hits } = await catalog.search({ text: 'тп', matches: true })
```

```python
await catalog.set("c-7", Course("Теория принятия решений"), aliases={"тп": "name"})
result = await catalog.search("тп", matches=True)
```

```go
err = catalog.Set(ctx, "c-7", Course{Name: "Теория принятия решений"}, search.Aliases{"тп": "name"})
result, err := catalog.Search(ctx, "тп", search.Matches())
```

```rust
catalog.id("c-7").aliases([("тп", "name")]).set(&decisions)?;
let found = catalog.search("тп").matches().run()?;
```

- No other document is found by the alias (contract SRCH-30). A change is
  one `set`, with no rebuild (contract SRCH-31).
- Use `synonyms` for a short form that means the same phrase everywhere, and
  `aliases` for a word that belongs to one document.
- search.db gains a table at its first open by 0.13.1, and 0.13.0 then
  refuses the file. Move every program on a store to 0.13.1 together.

## A page of a group

A group of `store.search` returned its first `limit` hits, a hundred at
most, with no way to the next. A group now pages as a search of its index
alone does, with `offset` and `limit` up to the 1000th hit
([A page of a group](https://tinyshed.org/tinystore/docs/guides/search/many.md#a-page-of-a-group)):

```ts
const found = await store.search({ text: 'algebra', in: [{ index: courses, limit: 20, offset: 20 }, { index: pages, limit: 5 }] })
```

```python
found = await store.search("algebra", among=[search.Among(courses, limit=20, offset=20), search.Among(pages, limit=5)])
```

```go
found, err := search.Many(ctx, store, "algebra",
	search.Among(courses, search.Limit(20), search.Offset(20)), search.Among(pages, search.Limit(5)))
```

```rust
let found = store.search("algebra").among(&courses, |a| a.offset(20).limit(20)).among(&pages, |a| a.limit(5)).run()?;
```

A hit's rank in `merged` counts the group's `offset`, so the 21st course
weighs what it would on a longer first page.

## A thousand values in a filter

A search's filter took a hundred values in its lists together, so a filter
of the courses a student may see stopped at a hundred courses. It now takes
1,000, as records' `where` and metrics' conditions do
([Filters](https://tinyshed.org/tinystore/docs/guides/search/filters.md)).

## Compare each group

`compare` answers whether the fleet is slower than usual. `compareGroups`
answers it for each group of series apart, which host is slower, a page of
groups at a time, and reads a group past 1,000 series in parts
([Each group, a page at a time](https://tinyshed.org/tinystore/docs/guides/metrics/compare.md#each-group-a-page-at-a-time)):

```ts
const page = await store.metrics.compareGroups({ name: 'rpc_ms', by: ['host'], op: 'avg', window: '15m', against: '1d', limit: 100 })
for await (const host of page) if ((host.ratio ?? 0) > 2) console.log(`${host.labels.host} is slow`)
```

```python
page = await store.metrics.compare_groups("rpc_ms", by=["host"], op="avg", window="15m", against="1d", limit=100)
async for host in page:
    if (host.ratio or 0) > 2:
        print(f"{host.labels['host']} is slow")
```

```go
page, err := metrics.CompareGroups(ctx, store, metrics.Comparison{
	Name: "rpc_ms", By: []string{"host"}, Op: metrics.Avg, Window: 15 * time.Minute, Against: 24 * time.Hour, Limit: 100,
})
```

```rust
let hosts = store.metrics()?.query().name("rpc_ms").by(&["host"]).limit(100)
    .compare(Op::Avg, Duration::from_mins(15)).against(Duration::from_hours(24));
for host in hosts.groups()?.all() {
    let host = host?;
    if host.ratio.is_some_and(|ratio| ratio > 2.0) {
        println!("{} is slow", host.labels["host"]);
    }
}
```

Each group comes with its `name` and `labels` beside what `compare` answers,
and the pages keep the first page's clock, so they compare the same windows
(contract MET-34). `compare` itself answers as before.

## Fill in pages

`fill` gave every bucket of the range, an empty one with no value, but
refused `limit`, so a year by the minute, 525,601 buckets, could not be
asked. With `limit` it now fills in [pages](https://tinyshed.org/tinystore/docs/guides/metrics/aggregates.md),
and `limit` counts the empty buckets too: six pages of `limit: 100_000` give
the buckets one call would (contract MET-35).

## How far back

A waiting job's `ahead` counts the jobs that run before it, up to 10,000,
and stopped there silently. `aheadAtLeast` now says when it stopped, more
being there: `ahead` is 10,000 and `aheadAtLeast` is true, never an estimate
(contract JOB-25). It is `ahead_at_least` in Rust and Python and
`AheadAtLeast` in Go.

## Encrypted once

`once` wrote its answers to kv.db as they were. Opened with `encrypted`,
every answer is sealed with the store's key, as an encrypted bucket's values
are, and `reseal` moves them to a new key
([Encrypted answers](https://tinyshed.org/tinystore/docs/guides/kv/once.md#encrypted-answers)):

```ts
const books = store.once<GradeBook>('grade-books', { fresh: '10m', keep: '1h', encrypted: true })
```

```python
books = store.once("grade-books", GradeBook, fresh="10m", keep="1h", encrypted=True)
```

```go
books, err := kv.OpenOnce[GradeBook](store, "grade-books", kv.Encrypted(), kv.Fresh(10*time.Minute), kv.Keep(time.Hour))
```

```rust
let books = store.once::<GradeBook>("grade-books").encrypted().fresh(Duration::from_mins(10)).keep(Duration::from_hours(1)).open()?;
```

A name remembers whether it is encrypted: opened the other way, it fails
with `invalid`. To encrypt a plain once, use a new name.

## A breaker's failures

A semaphore key's state now says how many holds failed in a row, the count
that puts the key down when it reaches the breaker's `failures`, so a status
page can show "2 of 3" before it goes down
([Semaphores](https://tinyshed.org/tinystore/docs/guides/locks/semaphores.md)):

```ts
const { up, failures } = await cabinet.state('requests')
```

A success sets it back to 0 (contract LOCK-15).

## Fixes

- MCP's `kv_list` and `jobs_list` cut their answer at 200 silently. Past
  it they now answer `{ entries, next }` or `{ jobs, next }`, and `after`
  reads on; an answer that fits is the list it was (contract MCP-10).

- A records `where` whose value passes 4 KiB, and an aggregate's sum past
  128 bits, now carry the `limit`, `wanted` and `bound` facts every other
  `limit` error carries: `WHERE_VALUE_BYTES` and `SUM_RANGE`.

- An option `once` does not know is refused, naming it, where Bun and Node
  dropped it.

- A field `store.search` or a group does not take is refused, naming it,
  where Bun and Node dropped it.

- `search list` no longer says an index was never opened once its rebuild
  switched in.

- The command line, on a store without nodes, says that the program holding
  the store applies a migration its file lacks, where it spoke of a copy and
  its home.
