Skip to main content

MongoDB

Versions

VersionStatusNotes
8AvailableRecommended
7Available
6Available

Connecting

ParameterValue
Host{name}.db.foundrydb.com
Port27017
Default databasedefaultdb
TLSRequired
mongosh "mongodb://USER:PASS@HOST:27017/defaultdb?tls=true"

Full connection string examples: Connection Strings →

Replica Sets

All MongoDB services run as a 3-member replica set by default, providing:

  • Automatic failover if the primary goes down
  • Read preference routing (secondaryPreferred, nearest)
  • Oplog-based point-in-time recovery

The replica set name is returned in the service detail response:

curl -u admin:password https://api.foundrydb.com/managed-services/{id} \
| jq '.replica_set_name'

Use it in your connection string for proper topology awareness:

mongodb://USER:PASS@HOST:27017/defaultdb?tls=true&replicaSet=rs0

Add Nodes

Scale to a 5-member replica set for higher read throughput:

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/nodes \
-H "Content-Type: application/json" \
-d '{"role": "replica"}'

Failover

Manual failover to a specific secondary:

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/nodes/{node_id}/failover

Automatic failover happens within ~10 seconds if the primary becomes unreachable. Your driver will reconnect automatically.

Point-in-Time Recovery

Continuous oplog archiving. Restore to any timestamp:

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/backups/restore \
-H "Content-Type: application/json" \
-d '{
"restore_point": "2026-03-15T14:30:00Z",
"target_service_name": "my-mongo-restored"
}'

Configuration

curl -u admin:password -X PATCH \
https://api.foundrydb.com/managed-services/{id}/configuration \
-H "Content-Type: application/json" \
-d '{
"parameters": {
"operationProfiling.slowOpThresholdMs": "100",
"operationProfiling.mode": "slowOp"
}
}'

Common parameters:

ParameterDefaultDescription
operationProfiling.modeoffProfiling: off, slowOp, all
operationProfiling.slowOpThresholdMs100Slow op threshold in ms
net.maxIncomingConnections65536Max connections

Indexes

Create indexes via the shell or driver to improve query performance:

// Compound index
db.orders.createIndex({ userId: 1, createdAt: -1 });

// Text search index
db.articles.createIndex({ title: 'text', body: 'text' });

// TTL index (auto-expire documents)
db.sessions.createIndex({ createdAt: 1 }, { expireAfterSeconds: 3600 });

Metrics

curl -u admin:password \
"https://api.foundrydb.com/managed-services/{id}/metrics?metric=connections&period=1h"

Key metrics: connections, opcounters, replication_lag, wiredtiger_cache_used.

Backups

# List backups
curl -u admin:password https://api.foundrydb.com/managed-services/{id}/backups

# Manual backup
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/backups \
-H "Content-Type: application/json" \
-d '{"backup_type": "manual"}'