Skip to content

Commit 7cd8398

Browse files
fix(mongodb): create user
1 parent c538461 commit 7cd8398

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,38 @@ You can create more users and grant them pre-set roles via the [Scaleway Managed
4040
All users you create have at first administrator roles, which can be changed after creation with the [Apply user roles](https://www.scaleway.com/en/developers/api/managed-database-mongodb/#path-users-apply-user-roles) call. The default user's role cannot be changed.
4141
</Message>
4242

43+
### How to create a user
4344

45+
1. Edit the POST request payload you will use to create your user. Replace the values of each parameters with your values of choice following the parameter descriptions below.
46+
```
47+
{
48+
"name": "<username>",
49+
"password": "<password>",
50+
}
51+
```
52+
53+
| Parameter | Description |
54+
| :--------------- | :----------------------------------------------------------------- |
55+
| `name` | Set a name for the database user. |
56+
| `password` | Set a password for the database user.|
57+
58+
2. Run the following command to create a user. Make sure you include the payload you edited in the previous step.
59+
```
60+
curl -X POST \
61+
-H "X-Auth-Token: $SCW_SECRET_KEY" \
62+
-H "Content-Type: application/json" \
63+
-d '{
64+
"name": "<username>",
65+
"password": "<password>",
66+
"roles": [
67+
{
68+
"role": "string",
69+
"database": "string",
70+
"any_database": true
71+
}
72+
]
73+
}' \
74+
"https://api.scaleway.com/mongodb/v1alpha1/regions/fr-par/instances/{instance_id}/users"
75+
```
4476

4577

0 commit comments

Comments
 (0)