How to Configure MongoDB Atlas Create User
You complete a mongodb atlas create user workflow by assigning a role to a login identity. That role lists which actions the user can run on a database or collection. Teams often start by creating shared logins for apps and engineers. When teams pick wide roles for speed, one login can change or drop whole collections. A good setup matches each user to the smallest role they need. How the mongodb atlas create user process works MongoDB uses role-based rules to control who can do what inside a
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You complete a mongodb atlas create user workflow by assigning a role to a login identity. That role lists which actions the user can run on a database or collection. Teams often start by creating shared logins for apps and engineers. When teams pick wide roles for speed, one login can change or drop whole collections. A good setup matches each user to the smallest role they need.
How the mongodb atlas create user process works
MongoDB uses role-based rules to control who can do what inside a cluster. Each role grants a set of actions on a clear target resource. The role works on the database where you define it. It can limit permissions down to a single collection level. Cloud database users have different built-in roles than self-hosted users. Both sets of roles still build from the same base actions.
When you set up a user, you choose between read and write permissions. The read role lets a user read all non-system collections in that database. It also lets the user read the system.js collection. This role includes actions like find, listCollections, listIndexes, dbStats, collStats, and changeStream. It does not let the user insert, update, remove, or drop a collection. That makes it a strong fit for support staff who only check data.
If a user or app must change data, you pick the readWrite role. The readWrite role gives every action in the read role plus write rights. Its actions include insert, update, remove, createCollection, createIndex, dropIndex, and dropCollection. You can scope both roles to one database or one collection. Doing this stops a user from touching other databases in the same cluster.
Where native database roles stop
Native roles solve the first problem of database security. They check who logs in and which collections that user can reach. A read role blocks a user from running an update or dropping a collection. A collection rule stops a user from reading other collections in the database. This setup keeps apps and people inside clear boundaries during daily work.
Still, native user creation leaves a big gap during live sessions. A role decides who logs in, not what individual queries return in flight. If a user has the read role on a customer collection, find returns every field. The database sends back raw emails, phone numbers, card numbers, and national IDs. Collection roles cannot rewrite those sensitive fields in query results on the fly.
User Provisioning (SCIM) + MongoDB Authentication & Authorization: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Write roles have a similar problem during live fixing sessions. An engineer with the readWrite role can run an update on one record. That same engineer also holds the power to run dropCollection or remove many rows. Native roles are static once the user logs in to the database. They do not ask for peer review before a risky write command runs. They also tie audit logs to a shared database user instead of a person.
How to keep user permissions tight in production
Start by separating app logins from human logins in your cluster. Give each app a role scoped only to the collections it needs to run. Do not share one readWrite login across multiple services or teams. For people, default to the read role on specific collections whenever possible. Review your user list often and remove old accounts that no longer need access.
When teams need to protect sensitive fields, collection roles alone are not enough. You also need a way to mask emails and card numbers in query results. And when engineers need to run write commands, static roles are too broad. Checking each command in flight helps prevent accidental drops and bad updates.
Check MongoDB commands and documents on the wire
MongoDB roles and SCRAM login decide who opens a session. They do not check single commands or redact sensitive fields inside returned documents. With hoop.dev, you run an open-source proxy, a sidecar for your MongoDB, inline in the MongoDB wire protocol. On every command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Before a command runs, hoop.dev guardrails check its effect and refuse banned drops or writes with MongoDB error code 13, or hold risky commands for approval. On the way back, hoop.dev data masking rewrites sensitive fields in returned documents in memory, and every verdict is logged. See the open-source code on GitHub.
Frequently asked questions
What is the finest level of permissions for a MongoDB role?
A role applies to a database and can limit permissions down to a single collection. It does not block specific fields inside the documents of that collection.
What is the difference between the read and readWrite roles?
The read role allows actions like find and listCollections without allowing data changes. The readWrite role adds actions like insert, update, remove, createIndex, and dropCollection.
Do cloud database users have the same built-in roles as self-hosted users?
No, cloud database users have a different set of built-in roles than self-hosted users. Still, both sets of roles are built from the same base privilege actions.
Related guides
In this post