NewOut Plane raises funding, backed by Maza VenturesRead the announcement
Databases

MongoDB

Overview

Deploy a MongoDB instance on Out Plane for applications that need flexible, schema-less data storage. MongoDB stores data as JSON-like documents with dynamic schemas, making it ideal for rapidly evolving data models, content management, real-time analytics, and IoT workloads where the data shape varies between records.

MongoDB provides horizontal scaling through sharding, the aggregation pipeline for complex data transformations, and change streams for real-time event processing. The template runs MongoDB as an app with a persistent volume, and you operate it yourself. The managed database on Out Plane is PostgreSQL.

Ideal for content management systems, real-time analytics platforms, mobile app backends, IoT data ingestion, product catalogs, and any application that benefits from flexible document storage over rigid relational schemas.


MongoDB Docker Setup: Auth, Volume, Cache and Upgrades

Updated

MongoDB is a document database that stores records as JSON-like documents. To self-host it with the official MongoDB Docker image, deploy mongo:8.0.34 on Out Plane as an application, attach a volume at /data/db, set MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD, and keep TCP port 27017 private. Your other apps then connect to mongomain:27017.

This guide covers the root variables that switch on authentication, container cache sizing, and in-place major upgrades. MongoDB runs here as an app you control. Out Plane's managed database is PostgreSQL.

What You Need

  • An instance size. op-34 (1 vCPU, 2 GB) is a sensible start. On op-20, 512 MB leaves little room beside the cache.
  • A volume. 10 to 50 GB, chosen once. There is no resize, so leave room to grow.
  • One instance. An app with a volume runs a single instance, so this is a standalone mongod.
  • A strong password. openssl rand -hex 24 gives one that needs no percent encoding in a connection string.

Check your features first. Standalone deployments do not support transactions, and change streams need a replica set. Prisma's MongoDB connector also requires one. If your app depends on these, the setup below is not enough on its own.

Deploy MongoDB on Out Plane

  1. Select Deploy MongoDB on the template page. It opens the console on your Applications page. Nothing is created yet.
  2. Optional shortcut: in the Ask Otto bar, a MongoDB chip may appear under Deploy a template (three of ten show at random). Otto then creates a 10 GB volume, deploys mongo:8 on private TCP port 27017 with the volume at /data/db, and shows a generated root password once. Then add the step 8 start command under Settings → Build with Save & deploy, and skip ahead, using its app name for mongomain.
  3. Otherwise, create an application and choose the Image source. Enter mongo:8.0.34. The mongo:7 shortcut there sets only an older image and a port, with no volume.
  4. Name the app mongomain. Names use letters and numbers, 5 to 45 characters, and are permanent.
  5. Under Ports, add 27017 with protocol TCP and leave Public TCP access unchecked.
  6. Under Environment variables, add MONGO_INITDB_ROOT_USERNAME=root and MONGO_INITDB_ROOT_PASSWORD with your generated value.
  7. Under Volumes, select Create volume, give it 10 GB or more, and set the mount path to /data/db.
  8. Under Configure, set the Start command to docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 0.5.
  9. Under Compute, pick op-34, keep the count at 1, and select Deploy app.

The same setup from the outplane CLI:

bash
outplane volume create mongodata --size 10 --json --fields id
outplane app create mongomain --image mongo:8.0.34 --port 27017:tcp --size op-34 \
  --env MONGO_INITDB_ROOT_USERNAME=root \
  --env MONGO_INITDB_ROOT_PASSWORD=<your-password> \
  --start-command "docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 0.5" \
  --volume <VOLUME_ID>:/data/db
outplane app get mongomain   # attaching is best effort, confirm the mount

Connect Your App to MongoDB

Other apps in your team reach every port at {app}:{port}, per the networking docs. Do not give the root account to your app. Open the Shell tab on mongomain and create a user for one database:

sh
mongosh -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin
js
use appdb
db.createUser({ user: "app", pwd: "<app-password>", roles: [{ role: "readWrite", db: "appdb" }] })

Then set the URL on your app and redeploy:

bash
outplane env set MONGODB_URI=mongodb://app:<app-password>@mongomain:27017/appdb --app <your-app> --deploy

This user authenticates against appdb, the database in the path. A root URL that names another database needs ?authSource=admin, because root lives in admin.

MongoDB Docker Environment Variables

These come from the official image docs:

VariableWhat it does
MONGO_INITDB_ROOT_USERNAMEWith the password, creates a user with the root role in the admin database.
MONGO_INITDB_ROOT_PASSWORDPassword for that user. Setting only one of the two stops the container.
MONGO_INITDB_DATABASEDatabase for .js init scripts in /docker-entrypoint-initdb.d. Defaults to test.

Three details matter on Out Plane:

  • The user is created on first boot only. If /data/db already holds data, the image leaves it alone. To change the password later, run db.getSiblingDB("admin").changeUserPassword("root", "<new-password>") in mongosh.
  • Keep both variables set. On every start, the entrypoint adds --auth only when both are present. Without them, MongoDB's default configuration requires no password at all.
  • Do not pass --bind_ip. The image adds --bind_ip_all unless you set your own, and Out Plane needs the server listening on 0.0.0.0.

Size the WiredTiger Cache

By default, WiredTiger takes 50% of (RAM minus 1 GB), or 256 MB if that is larger. MongoDB's WiredTiger docs say that in a container with less memory than the host, you must set --wiredTigerCacheSizeGB below the container's limit. Hence 0.5 on op-34. On op-46 (3.9 GB) the formula gives about 1.4. The start command replaces the image's entrypoint, so it must begin with docker-entrypoint.sh, or the user setup and --bind_ip_all never happen. To see the limit MongoDB detected, run db.hostInfo().system.memLimitMB.

MongoDB Docker Compose Example on Out Plane

Out Plane does not read compose files, so each service becomes its own app. The image docs ship this example with a mongo-express admin UI:

yaml
services:
  mongo:
    image: mongo
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example
  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
      ME_CONFIG_BASICAUTH_ENABLED: true
      ME_CONFIG_BASICAUTH_USERNAME: mongoexpressuser
      ME_CONFIG_BASICAUTH_PASSWORD: mongoexpresspass
  • mongo becomes mongomain. The example has no volumes entry, so Docker uses an anonymous volume. On Out Plane, files outside a volume are lost on restart, so mount one at /data/db.
  • mongo-express becomes a second app with public HTTP port 8081, at an address like https://mongoui-8081-acme.outplane.app. Set ME_CONFIG_MONGODB_URL to mongodb://root:<password>@mongomain:27017/, keep basic auth on, and link an IP access profile, since it is a full admin UI.

Custom Domain and HTTPS

Custom domains attach only to HTTP or H2C ports, so port 27017 takes none. The mongo-express app can: under Domains → Add domain, enter a host such as mongo.example.com, pick port 8081, and add the CNAME from the DNS dialog. HTTPS follows automatically once it resolves.

Updates and Backups

Image apps never deploy on their own. Pin a full version, since the mongo:8 tag currently points to 8.3.13, a minor release. For a patch, deploy the newer tag once published:

bash
outplane deploy create mongomain --image mongo:8.0.35 --wait

Major upgrades run in place on the same volume, one version at a time. To reach 9.0 you must run 8.0 or 8.3, so a 7.0 server goes to 8.0 first. MongoDB's upgrade steps for a standalone:

  1. Confirm your driver supports 9.0 and the feature compatibility version matches your release: db.adminCommand({ getParameter: 1, featureCompatibilityVersion: 1 }).
  2. Take a dump, then deploy mongo:9.0.4.
  3. After a burn-in period, run db.adminCommand({ setFeatureCompatibilityVersion: "9.0", confirm: true }). Until then, a downgrade stays simple.

Out Plane does not snapshot volumes, and deleting one keeps no copy, so your dumps are your backups. The image includes mongodump. To copy data off the platform, link an IP access profile that allows only your address, make the port public, and read the assigned host and port in the console. Then run this on a machine with the MongoDB Database Tools:

bash
outplane port set 27017::public --app mongomain --deploy
mongodump --uri "mongodb://root:<password>@<host>:<port>/?authSource=admin" --gzip --archive=mongo-2026-11-11.gz

The image does not set up TLS, so this connection is not encrypted. Make the port private again afterwards. To restore, run mongorestore with the same URI, --gzip and --archive=. Add --drop to drop each dumped collection first.

What MongoDB Costs on Out Plane

Compute is billed per instance-minute, and volumes cost $0.30 per GB per month while they exist.

  • Small: op-34 at $0.0004167 per minute ($18.00 for a 30-day month) plus 10 GB ($3.00) is $21.00 of usage. Starter ($9 a month, $9 of usage included) bills $21. Pro ($29, $15 included) bills $35.
  • Busier: op-46 at $0.0008333 per minute ($36.00) plus 20 GB ($6.00) is $42.00. Starter comes to $42, Pro to $56.

Starter and Pro both start with a 14 day free trial. See pricing for the full rates.

MongoDB Hosting: Self-Hosted or Atlas?

MongoDB's pricing page lists Atlas with a free 512 MB tier, Flex clusters at $0.011 per hour up to $30 a month, and dedicated clusters from $56.94 a month for 2 GB of RAM (checked 2026-11-11). Atlas sets up the replica set for you, so transactions and change streams work there. Self-hosting puts the database on the private network next to your apps, with full control of mongod flags. Still choosing a database? Read PostgreSQL vs MongoDB.

FAQ

How do I run MongoDB in Docker with a username and password?

Set both MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD before the first start. The image creates a user with the root role in admin and starts mongod with --auth. Add ?authSource=admin when the URL names another database.

Where does the MongoDB Docker image store data?

In /data/db, so mount your volume there. The image also declares /data/configdb, which is for config servers started with --configsvr.

Is mongo:8 the same as mongo:8.0?

No. Today mongo:8 is 8.3.13 and mongo:latest is 9.0.4, while mongo:8.0 is 8.0.34. Pin a full version so a redeploy never changes your release.



Start deploying in minutes

Connect your GitHub repository and deploy your first application today. Start with a 14-day free trial.

Start 14-day free trial