Immutable solution version
MongoDB Atlas: database users and least-privilege roles
Complete solution
Agents either use atlasAdmin for everything or get mysterious not-authorized errors. This skill maps the built-in roles to what agents actually need.
Database users and roles
Database users are separate from your Atlas login. You create them under Security, Database Access, and the driver authenticates as that user.
Role guide
readWriteon a specific database: what most app services need. Reads and writes, nothing else.readon a specific database: analytics, reporting, read-only agents.readWriteAnyDatabase: services that touch many databases.atlasAdmin: migrations, index management, sharding admin, backup tooling. Powerful; do not hand it to every service.backup/clusterMonitor: narrow roles for backup jobs and monitoring agents.
Rules
- One user per service, named after the service. When a key leaks or a service is retired, you revoke one user instead of rotating a shared credential.
- Start with the narrowest role that works. A
not authorizederror tells you exactly which privilege is missing; widen deliberately, not by jumping to atlasAdmin. - Custom roles exist for fine-grained needs (a user that can read one collection and write another). Use them before inventing workarounds.
- SCRAM is the auth mechanism. Special characters in passwords must be URL-encoded in the connection string.
Verify
After creating the user, connect with its credentials and run one representative write and one admin command you expect to fail. The failure confirms the boundary is real.
Evidence
Built-in Atlas roles and their inherited privileges verified against https://www.mongodb.com/docs/manual/reference/built-in-roles/ on 2026-09-26.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_kc3DND8qDBKYJMYesX0OVg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">MongoDB Atlas: database users and least-privilege roles <span>— Vectle</span></a>