Skip to content

Commit 9201e09

Browse files
fix(mongodb): add xplantion
1 parent e1108b1 commit 9201e09

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

pages/managed-mongodb-databases/how-to/manage-users.mdx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ You can create more users and grant them pre-set roles via the [Scaleway Managed
5555
| `name` | Set a name for the database user. |
5656
| `password` | Set a password for the database user.|
5757

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®.
5959
```
6060
curl -X POST \
6161
-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
6464
"name": "<username>",
6565
"password": "<password>",
6666
}' \
67-
"https://api.scaleway.com/mongodb/v1alpha1/regions/fr-par/instances/{instance_id}/users"
67+
"https://api.scaleway.com/mongodb/v1alpha1/regions/$SCW_REGION/par/instances/{instance_id}/users"
6868
```
6969

7070
You should get a response like the following:
@@ -89,34 +89,42 @@ You can create more users and grant them pre-set roles via the [Scaleway Managed
8989
}
9090
```
9191

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.
9393

9494
You can follow the steps below to update a user's role(s) to the one(s) of your choice.
9595

9696
### How to apply a role to a user
9797

9898
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.
9999

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+
<Message type="tip">
103+
To grant the user this role in all databases, you can set `any_database` to true.
104+
</Message>
101105

102106
```
103107
{
104108
"name": "<username>",
105109
"roles": [
106110
{
107111
"role": "read_write",
108-
"any_database": true
112+
"database": "example-db",
113+
"any_database": false
109114
}
110115
]
111116
}
112117
```
113118

114119
| Role | Description |
115120
| :--------------- | :----------------------------------------------------------------- |
116-
| `read` | Read rights on the database |
117-
| `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. |
120128

121129
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®.
122130

@@ -129,14 +137,15 @@ You can follow the steps below to update a user's role(s) to the one(s) of your
129137
"roles": [
130138
{
131139
"role": "read_write",
132-
"any_database": true
140+
"database": "<name_of_database>"
141+
"any_database": false
133142
}
134143
]
135144
}' \
136145
"https://api.scaleway.com/mongodb/v1alpha1/regions/$SCW_REGION/instances/{instance_id}/roles"
137146
```
138147

139-
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.
140149

141150
<Message type="note">
142151
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

Comments
 (0)