MongoDB
Deploy MongoDB 7 with persistent storage — document database with auto-generated credentials
Ink deploys MongoDB 7 as a container service with a persistent volume. Your agent provisions the database using a template, and Ink returns generated root credentials plus a connection string.
Deploying
Your agent uses the template_deploy MCP tool:
template_deploy(
"template": "mongodb",
"name": "my-db"
){
"services": [object Object],
"outputs": [object Object]
}Or via the CLI:
ink template deploy mongodb --name my-dbAuto-generated credentials
| Variable | Value |
|---|---|
MONGO_INITDB_ROOT_USERNAME | mongo |
MONGO_INITDB_ROOT_PASSWORD | Auto-generated at deploy time |
connection_string output | Full connection string with generated credentials |
Passwords are randomly generated. The agent receives them as outputs — no manual password management required.
Persistent storage
A persistent volume is attached at /data/db (10 Gi default). Data survives container restarts and redeployments.
Connecting
After deployment, template_deploy returns a connection_string output in the format:
mongodb://user:pass@hostname:27017The response also includes service endpoints. Sibling services in the same project can use the returned internal endpoint; external clients should use the returned connection string and generated password.
Client libraries
Node.js
npm install mongodbimport { MongoClient } from 'mongodb';
const client = new MongoClient(process.env.DATABASE_URL);
await client.connect();
const db = client.db();
const users = await db.collection('users').find().toArray();Python
pip install pymongoimport os
from pymongo import MongoClient
client = MongoClient(os.environ["DATABASE_URL"])
db = client.get_default_database()
users = list(db.users.find())Specs
| Property | Value |
|---|---|
| Engine | MongoDB 7 |
| Image | mongo:7 |
| Port | 27017 |
| Volume | /data/db |
| Default Memory | 512Mi |
| Default vCPU | 0.5 |