Limits & performance notes
Key limits
- Document size (encrypted): encrypted JSON must be ~5MB max (5,000,000 characters).
- Reserved keys: document
_idcannot start with\u0000__meta__:.
Performance tips (practical)
- Prefer
insertMany()over manyinsertOne()calls. - For streams/iterators, use
insertManyStream()(avoids holding everything in memory). - Create indexes for fields you filter on frequently (
db.createIndex(...)). - Use
find({ ... }, { limit, offset })for paging. - Use projections to return smaller payloads:
projection: ["email", "profile.age"]. - Run compaction periodically for long-lived workloads.
Concurrency model
- Each collection serializes its writes through an internal queue to keep ordering consistent.
- For multi-process scenarios, use manager IPC mode (see
IPC) rather than pointing multiple writers directly at the same root directory.
Backpressure (advanced)
If you're doing heavy write throughput, LioranManager exposes writeQueue options (like max queue size and behavior under memory pressure).
- TypeScript
- JavaScript
import { LioranManager } from "@liorandb/core";
const manager = new LioranManager({
rootPath: "./.liorandb",
writeQueue: {
maxSize: 50_000,
mode: "wait",
timeoutMs: 10_000,
},
batch: { chunkSize: 500 },
});
await manager.db("app");
await manager.close();
import { LioranManager } from "@liorandb/core";
const manager = new LioranManager({
rootPath: "./.liorandb",
writeQueue: {
maxSize: 50000,
mode: "wait",
timeoutMs: 10000,
},
batch: { chunkSize: 500 },
});
await manager.db("app");
await manager.close();