MongoDB
A managed MongoDB database. One command, one connection string.
AI/LLM: this page is available in plain markdown at /docs/resources/mongo.md
npx extraorbital add mongodb✓ Provisioned mongo/default (database cosmic-otter-default)
✓ Wrote 1 variable to .env — MONGODB_URIBoth mongodb and mongo work; the resource is addressed mongo/default. A project
that mentions MONGODB_URI anywhere gets this from
extraorbital provision without naming it.
What it writes
| Variable | Example |
|---|---|
MONGODB_URI | mongodb+srv://cosmic-otter-default:…@mongo.extraorbital.dev/cosmic-otter-default |
A dedicated MongoDB 7 database with a user scoped to it. The connection string carries the credentials, the database name and TLS, so one variable is all your code needs.
Options
npx extraorbital add mongodb [--slug <name>] [--region <region>]| Flag | Default | Description |
|---|---|---|
--slug | default | A second, fully separate database in the same project |
--region | us-east-1 | One of us-east-1, eu-central-1, ap-southeast-1 |
Options apply at creation. Re-running add with different options returns the
existing database unchanged.
Prototype allowance
512 MB of storage on shared RAM and vCPU on the Prototype plan, counted across your whole account and shared by up to five databases. Past it a database starts at $8.00/mo and scales with its size — our own cost, with nothing added — on a paid plan.
Use it
import { MongoClient } from "mongodb";
const client = new MongoClient(process.env.MONGODB_URI!);
const events = client.db().collection("events");
await events.insertOne({ type: "boot", at: new Date() });client.db() with no argument uses the database from the connection string, which is
the one your credentials are scoped to.
Next
- Quickstart — slugs, idempotency and sharing
- Pricing — plans, allowances and rates