Mongodb Datastore
MongoDB-backed swamp datastore — distributed locks with TTL, heartbeat, and nonce fencing, plus a manifest+content-addressed-blob sync protocol that streams the datastore tier as inline-bytes cursor batches. Dirty tracking rides an append-only journal with ancestor coalescing (O(1) markDirty) and pushes reconcile dirty roots in batches rather than one round-trip each. Blobs over 15 MB are transparently chunked across multiple docs so they fit under MongoDB's 16 MB BSON limit. Ships a companion maintenance model and workflow that inventory, sweep orphaned blobs and aged tombstones, and compact reclaimed space — fanning out over every namespace in one execution. Scoped by tenant + repo namespace. Requires MongoDB 4.0+ as a replica set.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| uri | string | MongoDB URI for the cluster backing the datastore (no auth baked in) |
| username | string | MongoDB username |
| password | string | MongoDB password — supply a vault reference, never a literal |
| database | string | Database shared by all tenants/repos |
| tenantId | string | Tenant identifier; the collection prefix is t_<tenantId>_r_<namespace> |
| Argument | Type | Description |
|---|---|---|
| namespaces | array | Namespaces to inspect; empty means every namespace found |
| Argument | Type | Description |
|---|---|---|
| namespaces | array | Namespaces to sweep; empty means every namespace found |
| dryRun | boolean | Report without deleting. Defaults true — opt in to deletion. |
| graceMinutes | number | Spare blobs created within this many minutes (in-flight pushes) |
| tombstoneDays | number | Spare tombstones deleted within this many days. Must exceed the longest gap between any peer's syncs, or a dormant peer resurrects deleted files. |
| skipBlobs | boolean | Prune tombstones only, leaving bytes for a maintenance window |
| activeIdleHours | number | A namespace written more recently than this counts as active; its blobs are swept only if they carry createdAt |
| Argument | Type | Description |
|---|---|---|
| namespaces | array | Namespaces to compact; empty means every namespace found |
| minReusableMb | number | Skip collections holding less reusable space than this |
Resources
Reclaim space in a MongoDB-backed swamp datastore: snapshot every namespace, prune tombstones past grace and blobs no live path references, then return the freed space to the filesystem. Requires a @keeb/mongodb-datastore/maintenance instance named datastoreMaintenance.
Stores swamp runtime coordination and datastore bytes in MongoDB — distributed locks with TTL + heartbeat + nonce fencing, plus manifest + content-addressed blob sync of the datastore tier between local cache and MongoDB. Blobs over 15MB are transparently chunked across multiple docs so they fit under MongoDB's 16MB BSON limit. Scoped by tenant + repo namespace. Requires MongoDB 4.0+ running as a replica set.
Added 1 models. Added 1 workflows
updated labels
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned