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.
To create a database using doctl
, you need to provide values for the --engine
, --region
, and --size
flags. Use the doctl databases options engines
, doctl databases options regions
, and doctl databases options slugs
commands, respectively, to get a list of available values.
You can also review a list of available slugs for each engine on its pricing page.
To create a database using the API, you need to provide values for the engine
, region
, and size
fields, which specify the database’s engine, its datacenter, and its configuration (number of CPUs, amount of RAM, and hard disk space). Use the /v2/databases/options
endpoint to get a list of available values.
You can also review a list of available slugs for each engine on its pricing page.
You can create a MongoDB database cluster at any time from the Create menu by selecting Databases. This takes you to the Create a Database page.
In the create menu, click Databases to open the database cluster creation page. This is where you choose your database cluster’s configuration, like the number and size of nodes and the datacenter region.
In the Choose a datacenter section, select the datacenter for your database cluster.
This page lists the datacenters in which you currently have the most resources. The number of resources you have in each datacenter is listed to the right as X resources. Hover over this text to see the specific resources you have in that datacenter.
For the best performance, create your database in the same datacenter as your other DigitalOcean resources. After creation, you cannot relocate your cluster to another datacenter.
In the Choose a database engine section, choose MongoDB.
We currently support version 6.0 and 7.0. You cannot change the MongoDB version after creating a cluster.
In the Choose a cluster configuration section, select a Droplet plan and quantity of nodes for the cluster.
Each option lists its combined monthly cost, equivalent hourly cost, and node specifications. For more options, click Additional product plans.
You can also add up to two standby nodes to your cluster. Standby nodes ensure that your data stays available by giving your cluster high availability and failover.
You can increase the number or size of database nodes at any time. However, you cannot downsize nodes to have less storage than the current storage the cluster is currently using.
In the Choose a storage size section, you can increase your storage by clicking the up arrow or entering your desired storage amount, in increments of 10 GB, up to the maximum listed in the storage range. Additional storage you add to the cluster costs $0.20 per GB per month.
You can increase your storage at any time. You cannot reduce the amount of storage in a cluster below the amount of storage you are currently using in your cluster.
In the last section, Finalize and Create, choose the name for the cluster, the project to add it to, and any tags you want to use.
There are three sub-headers in this section:
Choose a name: You can leave the automatically-generated name for the database or choose a custom name. Names must be unique, be between 3 and 63 characters long, and only contain alphanumeric characters, dashes, and periods.
Select a project: You can leave the default project or choose another one.
Tags: You can add a tag by typing it into the text box and pressing enter. Tags can only contain letters, numbers, colons, dashes, and underscores.
After creation, you can always edit the database’s tags or move it to another project; however, its name cannot be changed.
When you’re ready, click the Create a Database Cluster button.
Clusters typically take five minutes or more to provision, but you can complete important configuration tasks such as restricting inbound connections while you wait.