Skip to content
extraorbital
Documentation ExtraOrbital
Browse documentation

Data & storage

MongoDB

Add a MongoDB document database to your project.

Run in your project folder
npx extraorbital add mongodb

Each database has its own user. Its connection string includes authentication and TLS.

  1. 01 / Run the commandGet the service
  2. 02 / Read your .envUse its credentials
  3. 03 / Connect your appCall the SDK or API

Limits

LimitFree · PrototypePaid
Databases5No plan count cap
Storage512 MBUsage billed
ComputeShared RAM and vCPUShared
BandwidthIncludedIncluded
BackupsNoneCharged as storage
Inactive resource30 days after last usePersistent

Free allowances are shared across the account. Provider limits still apply on paid plans.

Use it

db.ts
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.

VariablePurpose
MONGODB_URIConnection string with database, credentials, and TLS

Specifics

Options

Terminal
npx extraorbital add mongodb [--slug <name>] [--tier <tier>]
FlagDefaultDescription
--slugdefaultA second, fully separate database in the same project
--tierdefaultInfrastructure 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

UsagePaid rate
StorageFrom $8.00 / mo, by size
ComputeShared
BandwidthIncluded

See pricing for team subscription fees, allowances, and billing terms. Plans and billing ↗