Create and manage users
Diese Seite ist noch nicht in deiner Sprache verfügbar. Englische Seite aufrufen
Prerequisites
Section titled “Prerequisites”- You have created a MongoDB Flex instance.
Check Create and manage instances for MongoDB Flex.
List, create, view and delete a user
Section titled “List, create, view and delete a user”List users
Section titled “List users”To get a list of all users for a MongoDB Flex instance:
| Flag | Description |
|---|---|
| instance-id | Instance ID of the instance you want to query |
stackit mongodbflex user list --instance-id <instance-id>You get the following output:
ID │ USERNAME─────────────────────────────────────┼──────────703e5cce-463c-43f9-975c-36be5a8e2511 │ n44pk1sj107d5d48-1540-4509-bc07-2a0ad0945c5b │ zvwn577e- Open your project in the STACKIT Portal.
- Navigate to Databases > MongoDB Flex.
- Choose your instance and go to the overview.
- On the sidebar, select Users.
Now you can see the list of users.
Create a user
Section titled “Create a user”To create a user for a MongoDB Flex instance:
| Flag | Description | Default | Optional |
|---|---|---|---|
| instance-id | Instance ID of the instance you want to query | ||
| database | Database name for which the permissions should be set | ||
| role | Role of the user (read, readWrite) | read | x |
| username | Username of the new user | x |
stackit mongodbflex user create --instance-id <instance-id> --database <database>You get the following output:
Created user for instance "mongodb-87ffl67rc1dd". User ID: a2a0e3d9-2281-4368-9337-a6903b613592
Username: zvwn577ePassword: S7ihJf9cbFdfzd7mRoles: [read]Database: booksHost: s-9092270d-c65a-45db-82bb-f259f3941f22-0.mongodb.eu01.onstackit.cloudPort: 27017URI: mongodb://zvwn577e:S7ihJf9cbFdfzd7m@s-9092270d-c65a-45db-82bb-f259f3941f22-0.mongodb.eu01.onstackit.cloud:27017/books?authSource=books&tls=true&authMechanism=SCRAM-SHA-256-
Navigate to Databases > MongoDB Flex.
-
Choose your instance and go to the overview.
-
On the sidebar, select Users.
-
On the top, click on Create user.
-
Set a username or leave it blank to assign a random username.
-
Roles: Either Read or Read and write, you can not change it afterwards.
-
Database name: If you enter an existing database, then the new user will get permissions on it. Otherwise the system creates this database for you automatically when creating the user. The database name must begin with a letter and can contain lowercase letters, numbers, underscores and hyphens. Cannot end with a hyphen.
-
Click on Create.
-
Copy all information to a safe place. You can’t retrieve this information again.
View a user
Section titled “View a user”To get details of a user for a MongoDB Flex instance:
| Flag | Description | Default | Optional |
|---|---|---|---|
| instance-id | Instance ID of the instance you want to query | ||
| user-id | The ID of the user (not its username) |
stackit mongodbflex user describe <user-id> --instance-id <instance-id>You get the following output:
ID │ a2a0e3d9-2281-4368-9337-a6903b613592──────────┼─────────────────────────────────────────────────────────────────────── USERNAME │ z8n9ybsi──────────┼─────────────────────────────────────────────────────────────────────── ROLES │ [read]──────────┼─────────────────────────────────────────────────────────────────────── DATABASE │ books──────────┼─────────────────────────────────────────────────────────────────────── HOST │ s-9092270d-c65a-45db-82bb-f259f3941f22-0.mongodb.eu01.onstackit.cloud──────────┼─────────────────────────────────────────────────────────────────────── PORT │ 27017-
Open your project in the STACKIT Portal.
-
Navigate to Databases > MongoDB Flex.
-
Choose your instance and go to the overview.
-
On the sidebar, select Users.
-
Click on the user entry you want to view.
Delete a user
Section titled “Delete a user”To delete a user for a MongoDB Flex instance:
| Flag | Description | Default | Optional |
|---|---|---|---|
| instance-id | Instance ID of the instance you want to query | ||
| user-id | The ID of the user (not its username) |
stackit mongodbflex user delete <user-id> --instance-id <instance-id>After confirmation you get the following output:
Deleted user "z8n9ybsi" of instance "mongodb-87ffl67rc1dd"-
Navigate to Databases > MongoDB Flex.
-
Choose your instance and go to the overview.
-
On the sidebar, select Users.
-
Click on the three dots on the right side of a user entry.
-
Click on Delete.