This topic summarizes account and permission FAQs for Document Database for MongoDB.
What account permissions does Document Database for MongoDB currently provide?
Document Database for MongoDB provides the following account permissions. For more details about account permissions, refer to Database and account permissions. Why is there already an account after instance created?
When you create a MongoDB instance, the system creates a root account with the built-in root permission of MongoDB in the admin database by default.
You can set the root account and password when Creating instance. You can also set the password for the root account after the instance is created. For specific procedures, refer to Resetting password. How to create MongoDB database account?
Document Database for MongoDB automatically creates an account with root permissions in the admin database by default. You can also create accounts with other permissions to give users specific permission for specific databases. For specific procedures, refer to Creating account. How to authorize cross-service access for IAM users?
Before using Document Database for MongoDB, you need to authorize cross-service access to allow Redis instances to access other services (such as VPC and EIP). For specific procedures, refer to Cross-service access authorization. If you need to authorize cross-service access for IAM users, the IAM users must have the IAMFullAccess permissions, otherwise an error will occur during authorization. For more information on how to authorize IAM users, refer to About users. How to change password of MongoDB database account?
You can choose any of the following methods to change database account password:
- Modify via MongoDB console
- You can call the ResetDBAccount API to modify the password of a specified account in the target MongoDB instance.
- Modify via db.changeUserPassword() command
- You can use the db.changeUserPassword() command to modify the password of a specified account (including root accounts and self-created accounts). For specific usage, refer to db.changeUserPassword().
Why do connections fail when account passwords in the connection string include special characters?
Document Database for MongoDB supports using _#!@$%^&*()+=- special characters in database account passwords. However, when you connect to a MongoDB instance via MongoDB shell tools or program code, some special characters may cause program ambiguity and cannot be recognized correctly, leading to connection failure. You need to escape these characters into their corresponding URL encodings before using them in the connection string for correct recognition.
Special characters that need to be escaped in the connection string and their corresponding URL encodings are shown in the table below.