Mongodb Datastore
MongoDB datastore for shared Swamp repositories: namespace-aware sync, managed configuration refresh, atomic remote control plane, distributed locks and content-addressed storage. Fork of @keeb/mongodb-datastore with a companion maintenance model and workflow. Requires a MongoDB replica set.
First James A. Keech Collective fork of @keeb/mongodb-datastore.
Adds namespace-aware synchronization, managed configuration refresh, and an atomic MongoDB control plane for shared swamp serve instances. Fixes namespaced scoped pulls so serialized writers retain distinct output versions. Preserves namespace dirty journals and lazy hydration state, and protects newer peer data during first-push reconciliation. Rejects ambiguous tenant collection names.
Retains the upstream MIT license and maintenance model/workflow. Swamp core managed model.edit propagation and data.get resolution issues remain outside this extension. Passive runtime queries on another server also remain stale because core does not request runtime refresh when selective pulls are honored. Partition/failover safety is not established by these compatibility tests.
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 @jamesakeech/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.
- 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 repository0/2missing