Skip to main content

Launch a Document Store

The document-store stack stands up a complete document database with a web admin console in one launch. You get a managed MongoDB database and a Mongo Express console already attached to it, so you can browse databases, collections, and documents, and run queries from your browser the moment the stack reaches Running.

What the document-store stack is, and who it is for

A document database stores records as flexible JSON-like documents instead of fixed rows and columns. MongoDB is the most widely used document database: you write collections of documents, query them with a rich query language, and evolve your schema as you go. Mongo Express is an open-source web admin UI for MongoDB that turns that database into something you can inspect and edit from a browser, without installing a client or memorizing shell commands.

This stack is for teams who want a document store they can use immediately:

  • Developers who want a managed MongoDB for an app and a console to inspect data during development.
  • Teams who need to browse and edit documents, run ad-hoc queries, or sanity-check a collection without wiring up a local client.
  • Anyone who wants their document data to stay in their own EU-resident database rather than a third-party SaaS.

Composition

The stack composes two FoundryDB primitives, wired together at launch:

ResourceWhat it isSpec
dbManaged MongoDB 7.0. The durable home for your documents. Exposes a TLS endpoint and a customer-facing primary user.tier-1, 25 GB standard storage
consoleA hosted Mongo Express web admin UI, attached to the database. Browse databases, collections, and documents, and run queries from the browser. Stateless: it stores nothing of its own.tier-1, 10 GB standard storage

MongoDB is where your data lives. Mongo Express is a thin admin layer on top: it stores no metadata of its own and reads your databases and collections live from the parent. Because MongoDB is a database you own, you can also connect any MongoDB driver or client to the same data directly, with no lock-in.

Document-store stack composition & launch
RUNNING Stack wired · Mongo Express console live
Stack Templatedocument-storelaunch ⇉MongoDBdatabaseMongo ExpressTLS → primaryserve →Web Consolebrowse · query
Template · launchMongoDB (database)Mongo Express (console)wiring (TLS → primary)

Prerequisites

Unlike the rag-chatbot stack, the document-store stack does not include an inference resource, so you do not need a configured inference provider to launch it.

Export your token for the commands below:

export FOUNDRYDB_TOKEN="your-api-token"

Launch it

Option A: one-click in the console

Open the Stacks catalog in the console, pick Launch a document store, review the cost preview, and click Launch. The console runs the same preview, accept, and launch flow described below and shows the live endpoint once the stack reaches Running.

Option B: the API

The launch is a two-step flow: preview the cost first, then send the launch request with the cost you accepted. This guarantees you always see an up-to-date estimate before any billable resource is created.

1. Preview the cost

curl -X POST https://api.foundrydb.com/stacks/preview \
-H "Authorization: Bearer $FOUNDRYDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"template_name": "document-store"}'

The response breaks the cost down per resource:

{
"template_name": "document-store",
"currency": "EUR",
"monthly_total": 51.00,
"line_items": [
{
"symbolic_name": "db",
"kind": "database",
"description": "MongoDB tier-1 + 25 GB standard storage",
"monthly_cost": 28.00,
"is_ceiling": false
},
{
"symbolic_name": "console",
"kind": "app",
"description": "Mongo Express app tier-1 + 10 GB standard storage",
"monthly_cost": 23.00,
"is_ceiling": false
}
],
"warnings": []
}

monthly_total is the figure you pass to the launch request. The cost preview is computed fresh on every call, so always preview right before launching.

2. Accept and launch

Pass the monthly_total from the preview as accepted_monthly_cost:

curl -X POST https://api.foundrydb.com/stacks \
-H "Authorization: Bearer $FOUNDRYDB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "my-document-store",
"template_name": "document-store",
"accepted_monthly_cost": 51.00
}'

The response is 201 Created with the stack in Pending status. Capture its id:

export STACK_ID="the-id-from-the-response"

If accepted_monthly_cost has drifted from the current estimate by more than EUR 0.01, the launch returns 409 Conflict and you re-preview. If it is omitted entirely, the launch returns 400 Bad Request.

3. Poll for status

The stack provisions asynchronously. Poll GET /stacks/{id} until status reaches Running:

curl https://api.foundrydb.com/stacks/$STACK_ID \
-H "Authorization: Bearer $FOUNDRYDB_TOKEN"

Typical progression is Pending then Provisioning then Wiring then Running. Most stacks complete within a few minutes. Once the stack is Running, the endpoint_url field carries the live Mongo Express URL:

{
"id": "...",
"name": "my-document-store",
"status": "Running",
"endpoint_url": "https://my-document-store-console.foundrydb.com",
"resources": [
{ "symbolic_name": "db", "kind": "database", "status": "Running", "service_id": "..." },
{ "symbolic_name": "console", "kind": "app", "status": "Running", "service_id": "..." }
]
}

First run

Open the console and sign in

Open the endpoint_url in a browser. Mongo Express is fronted by HTTP basic auth so the console is not open to the world. The username is admin; the password is a generated secret minted at first deploy. Reveal it from the console app resource through the credential reveal endpoint:

curl https://api.foundrydb.com/stacks/$STACK_ID \
-H "Authorization: Bearer $FOUNDRYDB_TOKEN" | jq '.resources[] | select(.symbolic_name=="console")'

The app resource exposes its credentials the same way any FoundryDB app service does. Sign in with admin and the revealed password.

Browse your databases and collections

Once you are in, Mongo Express lists the databases on the MongoDB primary. Open your application database, and you will see its collections. Click a collection to page through its documents. There is nothing to configure: the console is already connected to the database that launched alongside it.

Insert and query a document

You can write documents straight from the console. Open a collection (create one named notes if you do not have one yet), choose New Document, and insert:

{ "title": "First note", "tags": ["hello", "mongo"], "pinned": true }

Save it, and the document appears in the collection view. Mongo Express also accepts a query in the collection's search box, so you can filter to exactly what you want:

{ "pinned": true }

The view narrows to the matching documents. This is the same data any MongoDB client sees.

Connect a client or driver directly

The console is for browsing and quick edits. For application traffic, connect a MongoDB driver or mongosh to the database directly. The db resource exposes a TLS endpoint and a primary user; retrieve the connection details and a user password from the service (see MongoDB for the user and password endpoints), then:

mongosh "mongodb://<db-user>:<password>@<db-host>:27017/defaultdb?tls=true&authSource=defaultdb" \
--eval 'db.notes.insertOne({ title: "From a driver", pinned: false }); db.notes.find({ pinned: true })'

The document you inserted in the console and the one you inserted from the driver live in the same collection. The console and your application are two views of one database you own.

How the wiring works

The stack engine does not introduce a new provisioning path. It calls the same APIs you would call yourself, in dependency order, and injects the configuration each resource needs.

For the document-store stack:

  1. The db resource is provisioned first: a managed MongoDB 7.0 service with a TLS endpoint and a customer-facing primary user.
  2. The console resource is provisioned and attached to the database. During the Wiring phase, the engine injects a single full connection URL into Mongo Express as its connection string.
  3. Mongo Express connects on first boot directly to the served MongoDB primary over TLS and comes up serving the admin UI.

The console connects with directConnection=true to the primary that serves the cluster, over TLS. The connection string is the single source of truth for that hop: it encrypts the connection and authenticates the customer-facing primary user against its own database. There is no connection string to copy, no firewall rule to open by hand, and no environment variable to paste into a settings panel. The console already knows where the database is and how to reach it the moment the stack reaches Running.

Cost and EU residency

The document-store stack costs the sum of its two resources, shown in your cost preview at launch (tier-1 MongoDB plus a tier-1 Mongo Express console). Each child resource is an ordinary service in your account, billed through your normal plan. You can scale either one individually after launch. Figures above are illustrative; the preview returns the current cost.

Both resources are EU-resident. The MongoDB database, the Mongo Express console, and the traffic between them all stay within the platform's European footprint. Residency is not a setting you remember to flip; it is where the platform runs.

Teardown

Delete the whole stack with one call:

curl -X DELETE https://api.foundrydb.com/stacks/$STACK_ID \
-H "Authorization: Bearer $FOUNDRYDB_TOKEN"

Returns 202 Accepted. The reconciler deletes the console first, then the database, in reverse dependency order. Teardown is atomic and leaves no orphaned database or app behind. It is irreversible, so export anything you want to keep first.

Next steps

  • Stacks Overview: how stacks compose primitives, the catalog, and the lifecycle.
  • Launch a Stack: the full preview, launch, retry, and teardown reference.
  • MongoDB: scale, back up, and connect directly to the database under your document store.
  • Upgrades: adopt new template versions of the stack in place.