Introducing Managed MongoDB on DigitalOcean

Check Out More At: Digital Ocean

Web Hosting: Digital Ocean | Digital Ocean Affiliate Program

Introducing Managed MongoDB on DigitalOcean

DigitalOcean

Digital Ocean is a cloud hosting platform that offers compute power, storage, and networking services.

It enables developers to deploy and manage applications in the cloud quickly and easily, with features such as one-click application installations, automatic backups and scaling.

We earn a commission if you make a purchase, at no additional cost to you.

DigitalOcean Managed Databases make it easy to set up, maintain, and scale your MongoDB database on DigitalOcean. The hosting platform provides a fully managed MongoDB service that is purpose-built for reliability, performance, and security.

This guide will show you how to get started with DigitalOcean Managed MongoDB. You will learn how to create a database, add a user, and configure your application to connect to the database.

Creating a DigitalOcean Managed MongoDB Database

DigitalOcean Managed MongoDB databases are created through the Control Panel.

Log in to the Control Panel and click on the “Create” button in the top left-hand corner. Select “Databases” from the list of options.

On the next page, you will select MongoDB from the list of available database engines.

Enter a name for your database in the “Name” field and choose the region you want to deploy it in from the “Region” drop-down menu.

You will also need to specify a “Version” for your database. DigitalOcean currently offers MongoDB 3.4 and 4.0.

Once you have filled out the required fields, click on the “Create Database” button to provision your new database.

Adding a User to Your MongoDB Database

After your database has been created, you will need to add a user. This can be done through the Control Panel or the MongoDB Shell.

Adding a User Through the Control Panel

To add a user through the Control Panel, click on the “Users” tab for your database.

On the next page, click on the “Add User” button.

Enter a username and password for the user in the appropriate fields. You can also specify the roles you want to assign to the user. For more information on roles, see the MongoDB documentation.

Once you have entered the required information, click on the “Add User” button to create the user.

Adding a User Through the MongoDB Shell

You can also add a user through the MongoDB shell. To do this, connect to your database using the mongo command.

mongo –host YOUR-DB-HOSTNAME –port 27017

Once you are connected, use the following command to create a new user:

db.createUser({ user: “USERNAME”, pwd: “PASSWORD”, roles: [ “READ”, “WRITE” ] })

Replace “USERNAME” and “PASSWORD” with the appropriate values for your user.

Configuring Your Application to Connect to the Database

After you have created your database and added a user, you will need to configure your application to connect to the database.

The MongoDB Connection URI

The MongoDB connection URI is a standard URI format that is used to specify the location of a MongoDB database. The URI for your database can be found in the Control Panel under the “Overview” tab.

MongoDB URI Format

The MongoDB URI format is as follows:

mongodb://USERNAME:PASSWORD@HOSTNAME:PORT/DATABASE

Replace “USERNAME”, “PASSWORD”, “HOSTNAME”, “PORT”, and “DATABASE” with the appropriate values for your environment.

Configuring a Node

Similar Posts