Deploying a MongoDB instance on DigitalOcean is simple with the MongoDB One-Click application. It allows you to spin up a server with MongoDB pre-installed so you can get your application off the ground quickly.

Launching a MongoDB Instance

You can launch a new MongoDB instance by selecting MongoDB from the Applications tab on the Droplet create page:


Once you have created your server, you can connect to it via the web-based console in the DigitalOcean control panel or via SSH:

ssh root@your.ip.address

Using the API

One-Click Application images are also available via DigitalOcean’s RESTful API. Use the slug ("mongodb") rather than an ID when specifying the image to ensure you are using the most up to date version.

The following example will launch a launch a 2 GB server with private networking enabled, running MongoDB in the NYC3 region. Remember to replace the API access token with one of your own obtained in the DigtialOcean control panel.

curl -X POST -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer b7d03a6947b217efb6f3ec3bd3504582' \
    -d '{"name":"", "region":"nyc3","size":"2gb", "image":"mongodb", "private_networking":true}' \

Instance Details

The environment on your new server will consist of:

  • Ubuntu 14.04 LTS
  • MongoDB 3.x installed via Apt from the upstream repository

MongoDB will be available at port 27017 and is bound to the localhost by default. Its data is stored in /var/lib/mongodb/. You can view or modify its configuration details in /etc/mongod.conf.

To connect to the test database with the MongoDB shell, simply run:


The daemon will be running by default and can be managed using the native service commands, i.e.:

sudo service mongodb restart

Additional Information

The One-Click application simply provides you with MongoDB as a pre-installed base. It’s up to you how you want to use it. Whether you are building out a sharded cluster or simply want to connect it to an app on the same host, the DigitalOcean community has a number of tutorials which should point you in the right direction:

A MEAN Stack One-Click application image is also available. It provides Node.js, Express, and AngularJS pre-installed along side of MongoDB.