How to Secure MongoDB Managed Database Clusters
Validated on 28 Jun 2021 • Last edited on 16 Apr 2025
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 ensure that your data is safe, consider taking the following precautions.
Restrict Incoming Connections
You can greatly decrease the likelihood of a security breach by restricting which DigitalOcean resources or external IP addresses are allowed to access the nodes in a cluster. This prevents brute force password and denial-of-service attacks from any server not explicitly permitted to connect.
Typically, only the application servers are allowed to connect to the database cluster. Users access the public-facing site, and the public-facing server authenticates and manages database connections in turn.
Add a Trusted Source Using the CLI
Add a Trusted Source Using the API
Add a Trusted Source using the Control Panel
To restrict access to a database cluster, click the name of the cluster in the control panel to go to its Overview page, then click the Settings tab.

In the section titled Trusted Sources, click Edit to open the Add trusted sources text box.

You can enter Droplets, Kubernetes clusters, tags, or specific IP addresses. Entering a tag provides access to the database for any Droplets or Kubernetes nodes containing that tag. At this time, DigitalOcean Cloud Firewalls are not supported.