MongoDB
Add a MongoDB document database to your project.
npx extraorbital add mongodbEach database has its own user. Its connection string includes authentication and TLS.
- 01 / Run the commandGet the service
- 02 / Read your .envUse its credentials
- 03 / Connect your appCall the SDK or API
Limits
| Limit | Free · Prototype | Paid |
|---|---|---|
| Databases | 5 | No plan count cap |
| Storage | 512 MB | Usage billed |
| Compute | Shared RAM and vCPU | Shared |
| Bandwidth | Included | Included |
| Backups | None | Charged as storage |
| Inactive resource | 30 days after last use | Persistent |
Free allowances are shared across the account. Provider limits still apply on paid plans.
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() uses the database named in MONGODB_URI.
Environment variables
The CLI writes these to .env or an existing .env.local.
| Variable | Purpose |
|---|---|
MONGODB_URI | Connection string with database, credentials, and TLS |
Specifics
Options
npx extraorbital add mongodb [--slug <name>] [--tier <tier>]| Flag | Default | Description |
|---|---|---|
--slug | default | A second, fully separate database in the same project |
--tier | default | Infrastructure placement tier, mapped to a pool by the administrator |
Options apply at creation. Re-running add with different options returns the
existing database unchanged.
The connection hostname stays the same when a database moves between infrastructure pools. Unknown tiers and unavailable pools return an error.
Connection and placement
mongo and mongodb are aliases. Credentials are scoped to one database. The connection hostname stays stable across infrastructure-pool moves; unknown tiers return an error.
Pricing
| Usage | Paid rate |
|---|---|
| Storage | From $8.00 / mo, by size |
| Compute | Shared |
| Bandwidth | Included |
See pricing for team subscription fees, allowances, and billing terms. Plans and billing ↗