You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/managed-mongodb-databases/how-to/manage-users.mdx
+20-11Lines changed: 20 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ You can create more users and grant them pre-set roles via the [Scaleway Managed
55
55
|`name`| Set a name for the database user. |
56
56
|`password`| Set a password for the database user.|
57
57
58
-
2. Run the following command to create a user. Make sure you include the payload you edited in the previous step.
58
+
2. Run the following command to create a user. Make sure you include the payload you edited in the previous step.`{instance_id}` corresponds to the UUID of the Managed MongoDB®.
59
59
```
60
60
curl -X POST \
61
61
-H "X-Auth-Token: $SCW_SECRET_KEY" \
@@ -64,7 +64,7 @@ You can create more users and grant them pre-set roles via the [Scaleway Managed
@@ -89,34 +89,42 @@ You can create more users and grant them pre-set roles via the [Scaleway Managed
89
89
}
90
90
```
91
91
92
-
All users you create will have the `read_write`, `db_admin` and `sync` roles by default.
92
+
All users you create will have the `read_write`, `db_admin` and `sync` roles on all databases by default.
93
93
94
94
You can follow the steps below to update a user's role(s) to the one(s) of your choice.
95
95
96
96
### How to apply a role to a user
97
97
98
98
1. Edit the POST request payload you will use to update the user role. Replace the values of each parameter with your values of choice following the parameter descriptions below.
99
99
100
-
In this example, we define a single `read_write` role for the user.
100
+
In this example, we define a single `read_write` role for the user. This role applies only in the `example-db` database.
101
+
102
+
<Messagetype="tip">
103
+
To grant the user this role in all databases, you can set `any_database` to true.
|`read_write`| Read and write rights on the database|
118
-
|`db_admin`||
119
-
|`sync`||
121
+
|`read`| Read privileges on all non-system collections and the `system.js` collection. Refer to the [official MongoDB® documentation](https://www.mongodb.com/docs/manual/reference/built-in-roles/#mongodb-authrole-read) for an extensive list of the privileges granted to this role. |
122
+
|`read_write`| Read and write privileges on all non-system collections and the `system.js` collection. Refer to the [official MongoDB® documentation](https://www.mongodb.com/docs/manual/reference/built-in-roles/#mongodb-authrole-readWrite) for an extensive list of the privileges granted to this role. |
123
+
|`db_admin`| Privileges to perform administrative tasks on the database, such as schema-related tasks, indexing, and gathering statistics. This role does not grant privileges for user and role management. Refer to the [official MongoDB® documentation](https://www.mongodb.com/docs/manual/reference/built-in-roles/#mongodb-authrole-dbAdmin) for an extensive list of the privileges granted to this role. |
124
+
|`sync`| Role that aggregates three MongoDB roles: |
125
+
||`clusterMonitor` - Read-only access to monitoring tools. Refer to the [official MongoDB® documentation](https://www.mongodb.com/docs/upcoming/reference/built-in-roles/#mongodb-authrole-clusterMonitor) for an extensive list of the privileges granted to this role. |
126
+
||`backup` - Grants the minimal privileges needed to back up data. Refer to the [official MongoDB® documentation](https://www.mongodb.com/docs/upcoming/reference/built-in-roles/#mongodb-authrole-backup) for an extensive list of the privileges granted to this role. |
127
+
||`restore` - Grants the privileges needed to restore data from backups. Refer to the [official MongoDB® documentation](https://www.mongodb.com/docs/upcoming/reference/built-in-roles/#mongodb-authrole-restore) for an extensive list of the privileges granted to this role. |
120
128
121
129
2. Run the following command to apply a new role to the user. Make sure you include the payload you edited in the previous step and that you replace the parameters in the call with your information. `{instance_id}` corresponds to the UUID of the Managed MongoDB®.
122
130
@@ -129,14 +137,15 @@ You can follow the steps below to update a user's role(s) to the one(s) of your
If the call was successful, you will get the payload with the new roles as a response.
148
+
If the call was successful, you will get the payload with the new role(s) as a response.
140
149
141
150
<Messagetype="note">
142
151
Assigning roles upon user creation will be possible by the second half of 2025. Refer to the [Scaleway Changelog](/docs/changelog/?product=mongodb) to keep up with the latest Managed MongoDB® updates.
0 commit comments