How to Manage MongoDB Users and Databases in a Database Cluster

MongoDB is a source-available cross-platform document-oriented database program for high-volume storage. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas.

MongoDB database clusters come configured with a default database (admin) and a default administrative user (doadmin). These defaults are necessary for cluster replication and administration, so you can’t delete them, but you can add additional users and databases.

Tip
If you connect to the database cluster with preconfigured connection details from the cluster’s Overview page, you can edit them to use a different user and password or a different database.

You cannot add users to a cluster using the mongo shell. Users must be added to the cluster using the DigitalOcean Control Panel. To add or delete users or databases to a database cluster, click the name of the database to go to its Overview page, then select the Users & Databases tab.

Screenshot of Users and Databases screen

Create new users in the Users section by entering a name in the Add new user field and clicking Save. The new user receives a password that you can view temporarily. Copy the password and store it safely.

New users will receive the permissions of the doadmin user by default. You can’t change these permissions at this time.

You can also delete a user here by opening the user’s More menu, clicking Delete, and then confirming the deletion. Similarly, to reset a user’s password, open the user’s More menu and select Reset password.

Create a new database in the Databases section by entering a name in the Add new database field and clicking Save. You can also delete a database here by opening its More menu, clicking Delete, and then confirming the deletion.