Why a read-only MongoDB viewer is safer
Most data incidents start with someone who meant to look, not touch. Decompass removes the “touch” part entirely, so you can open it against any database without worrying.
How Decompass enforces read-only
- No write code paths. The codebase contains no
insert,update,replace,delete,drop,createIndex, orbulkWritecalls, and the UI has no buttons for them. - Write stages blocked. Aggregation pipelines containing
$outor$mergeare rejected before they reach MongoDB. We tested it:POST /api/local-demo/shop/users/aggregate → "write stage $out not allowed in read-only explorer" - No disk spill.
allowDiskUsestays off, so a heavy pipeline can't quietly spill to disk on a shared cluster. - Timeouts on everything. The server enforces
maxTimeMS: 10 s by default and 30 minutes at most. Cancel attempts a server-sidekillOp. - Gentle on primaries. Clients use
secondaryPreferredreads and bounded connection pools (max 20), and idle clients close after ~5 minutes. - Local only. Decompass binds to
127.0.0.1and checks theHost,Origin, and a customX-Decompassheader on every API call. That blocks CSRF and DNS-rebinding attempts from other tabs.
Defense in depth: pair it with a read-only user
Decompass's guarantee lives in its own code. For a guarantee that holds no matter which client connects, give it credentials that can only read. In mongosh, as an admin:
use admin
db.createUser({
user: "decompass_reader",
pwd: passwordPrompt(),
roles: [ { role: "read", db: "shop" } ]
})
On Atlas, create a database user with the built-in Only read any database role instead.
What read-only doesn't protect against: reads still use cluster resources,
connections.json stores URIs in plain text, and the mongosh launcher opens a full read/write shell, on purpose.So where do writes go? mongosh.
Browse with Decompass, write with mongosh. Use Decompass to find exactly what you want to change and check the count and explain plan. Then switch to a shell, where writes are explicit and deliberate:
// 1. In Decompass: confirm the filter matches what you expect
{ status: "trial", trialEnds: { $lt: ISODate("2026-01-01") } }
// 2. In mongosh: apply the change
db.accounts.updateMany(
{ status: "trial", trialEnds: { $lt: ISODate("2026-01-01") } },
{ $set: { status: "expired" } }
)
Try the “try to write” sandbox · Compare with Compass · Install