Skip to content

Commit b5d19d3

Browse files
committed
MongoDB docs
1 parent c5fe3ba commit b5d19d3

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Managed MongoDB
3+
description: Defang can help you provision managed MongoDB instances.
4+
sidebar_position: 3000
5+
---
6+
7+
# Managed MongoDB
8+
9+
:::info
10+
This feature was introduced in Defang v1.2.0 released on June 3, 2025.
11+
:::
12+
13+
Managed MongoDB is a service that allows you to store and retrieve large amounts of data in a document-oriented format. MongoDB is ideal for storing unstructured data like JSON documents, making it a popular choice for modern applications.
14+
15+
## Current Support
16+
17+
| Provider | Managed MongoDB |
18+
| --- | --- |
19+
| [Playground](/docs/providers/playground#managed-services) ||
20+
| [AWS](/docs/providers/aws#managed-storage) ||
21+
| [DigitalOcean](/docs/providers/digitalocean#future-improvements) ||
22+
| [GCP](/docs/providers/gcp#future-improvements) ||
23+
24+
## How to use Managed MongoDB
25+
26+
To use managed MongoDB, in your `compose.yaml` file, use the `x-defang-mongodb` extension to define your MongoDB service. Adding the extension will tell Defang to provision a managed instance, rather than running MongoDB as a container.
27+
28+
### Required Configuration
29+
30+
When using managed MongoDB, you **must** set a username and password for the database. By default, these are read from the `MONGO_INITDB_ROOT_USERNAME` and `MONGO_INITDB_ROOT_PASSWORD` config variables, conform [the official MongoDB container image](https://hub.docker.com/_/mongo). These can be set using the `defang config set MONGO_INITDB_ROOT_USERNAME` and `defang config set MONGO_INITDB_ROOT_PASSWORD` commands. If you do not provide these values, the deployment will fail.
31+
32+
### Example
33+
34+
```yaml
35+
services:
36+
app:
37+
# [...]
38+
environment:
39+
MONGO_URI: mongodb://$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@db:27017/
40+
depends_on:
41+
- db
42+
43+
db:
44+
image: mongo:5
45+
x-defang-mongodb: true
46+
```
47+
48+
:::warning[Version]
49+
AWS DocumentDB is compatible with MongoDB 3.6, 4.0, and 5.0. The `mongo:5` image is compatible with DocumentDB 5.0, so we recommend using this version for your MongoDB service. Deployment will fail for versions higher than 5.
50+
:::

docs/providers/aws/aws.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ Defang offers integration with managed, cloud-native large language model servic
7878

7979
When using [Managed LLMs](/docs/concepts/managed-llms/managed-language-models.md), the Defang CLI provisions an ElastiCache Redis cluster in your account.
8080

81+
### Managed MongoDB
82+
83+
Defang will provision a DocumentDB instance for services that use the `x-defang-mongodb` service extension. This allows you to use MongoDB as a managed service, rather than running it as a container.
84+
8185
### Managed Resources
8286

8387
Defang will create and manage the following resources in your AWS account from its bootstrap CloudFormation template:

0 commit comments

Comments
 (0)