The same view. A new place to run it.
CouchDB-inspired map/reduce, running right here. An AssemblyScript view maps your documents and reduces each group in WebAssembly. No server required.
| Metric | Count | Mean | Min | Max |
|---|---|---|---|---|
| Loading the example… | ||||
Loading the shared view module.
Loading…JavaScript retains documents and groups emitted keys. The AssemblyScript module performs every map and reduction. This is the same compiled artifact used by the native engine.
The metrics module accepts documents with a string metric and a finite numeric value. Its map emits the metric as a key. Its reducer maintains count, sum, minimum, and maximum; finalization computes the mean. Other document shapes are ignored by the map.
Numbers use double precision in both environments. Keep large identifiers as strings. Strings must be valid Unicode; each module request is limited to 256 KiB of encoded JSON.
import { BrowserDatabase } from "./portable/client.js";
const db = await BrowserDatabase.connect();
await db.add({ metric: "latency_ms", value: 42 });
const rows = await db.rows();
console.log(rows[0].result);
db.close();from foldlitedb import Database, View
view = View.bundled("metrics")
with Database("metrics.fold", view) as db:
db.add({"metric": "latency_ms", "value": 42})
row = list(db.rows())[0]
print(row.result)Try the live stream, add a few measurements, then select Rebuild & verify. A fresh in-memory database replays every retained document through the same module and compares its complete view states and results. Existing views keep their cursors.
Exported JSON includes document identities, sources, positions, and payloads. Importing it again is an identical replay: each retained document counts once. Changing an existing identity or position fails the whole batch. Use those same records to rebuild the native database.
A portable computation preview. This browser database keeps documents and view history in memory. Export them to keep your work. The live stream is simulated locally; this page makes no requests containing your documents. Python provides the persistent Rust document-log engine with a disposable view cache.