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

# TinyStore 0.4.1

TinyStore 0.4.1 came out on 31 October 2026. Search can now answer a search
box while its reader types, finding the words that a half-typed word begins.
A key that a nested `with` gives again now has one value wherever you look,
and two fixes make jobs and copies of a store more reliable.

- **Search**
  - [As you type](#as-you-type): `prefix` reads the last word as the start of longer words.

## As you type

A search box that answers on every keystroke sends a word typed halfway:
`crypt` on its way to `cryptography`. With `prefix`, Search reads the last
word of the text as the start of a word too, so the box finds every document
with a word that starts with it:

```ts
const courses = store.index<{ name: string }>('courses', { fields: { name: 1 } })
const { hits } = await courses.search({ text: 'crypt', prefix: true })
// Cryptanalysis, Cryptography, Foundations of cryptography, Cryptographic methods of information security
```

```python
courses = store.index("courses", Course, fields={"name": 1})
result = await courses.search("crypt", prefix=True)
```

```go
courses, err := search.OpenIndex[Course](store, "courses", search.Fields{"name": 1})
result, err := courses.Search(ctx, "crypt", search.Prefix())
```

```rust
let courses = store.index::<Course>("courses").field("name", 1.0).open()?;
let found = courses.search("crypt").prefix().run()?;
```

- Only the last word is a prefix, and only while the reader may still be
  typing it: `crypt ` with a space after it is a whole word, and so is a
  single letter.
- The words a prefix begins weigh half their field's weight, so a document
  that holds the word as typed usually ranks first.
- A half-typed word that begins a word in the index is never read as a typo.
  One that begins nothing is corrected as any word is, and `corrected` says
  so.
- A prefix reads at most the 64 words that it begins and that the most
  documents hold, in each field.

[As you type](https://tinyshed.org/tinystore/docs/guides/search/prefix.md) has the details.

## Fixes

- A key that a nested `with` gives again replaces the outer value, as an
  object spread does. Before, `log.with({ component: 'http' })` and then
  `.with({ component: 'access' })` printed both values, kept only `access`,
  and `where` found the event by either. Now the console prints
  `component=access` once, the event keeps it, and a `where` by
  `component: 'http'` doesn't find the event. The same holds for `bind` in Python,
  `With` in Go and a span inside another in Rust. A key written twice in an
  event, as another program's line may write it, is found by its last value,
  in events that 0.4.0 kept too.
- A worker that starts as its store closes now stops with the store, instead
  of writing to a file that is already closed.
- A copy of a store that took the first commit of its home's `blobs.db` no
  longer drops its link to the home again and again.

## Install

```sh for=bun
bun add @tinyshed/tinystore@0.4.1
npm install @tinyshed/tinystore@0.4.1
```

```sh for=python
pip install tinyshed-tinystore==0.4.1
```

```sh for=go
go get tinyshed.org/tinystore@v0.4.1
```

```sh for=rust
cargo add tinystore@0.4.1
cargo install tinystore-cli@0.4.1
```

Nothing in a store's files changes, so 0.4.0 and 0.4.1 open each other's
stores. If your program reaches a server, update the server with the SDK
before you search with `prefix`: a 0.4.0 server refuses it with an
`unimplemented` error that names the field. The server image is
`ghcr.io/tinyshed/tinystore:0.4.1`.

Every commit since 0.4.0 is in the
[GitHub release](https://github.com/tinyshed/tinystore/releases/tag/v0.4.1).
