Supported platforms
| Platform | Support |
|---|---|
| Self-hosted MongoDB | 4.x, 5.x, 6.x, 7.x |
| MongoDB Atlas | All versions |
Prerequisites
- A MongoDB instance or Atlas cluster reachable from CloudThinker over the network.
- Admin access to create a dedicated database user and assign roles.
- The MongoDB connection string with credentials.
Setup
Select your MongoDB platform for specific connection instructions.- Self-hosted MongoDB
- MongoDB Atlas
Connect as admin
Connect to your MongoDB instance using the Mongo shell (
mongosh) with administrative privileges.Replace <admin-user>, <admin-password>, and <your-host> with your credentials. The /admin database is required.Create a read-only user
Create a dedicated user for CloudThinker using standard MongoDB built-in roles:The
clusterMonitor role is recommended for performance metrics analysis.Configure network access
Ensure CloudThinker can reach your database:
- Add CloudThinker IPs to your firewall or security group
- Ensure MongoDB is bound to an accessible IP address in
mongod.conf
Connection details
| Field | Description | Example |
|---|---|---|
| Connection string | Full MongoDB URI including credentials | mongodb+srv://user:pass@host/admin?tls=true |
| TLS/SSL | Enforce TLS for the connection — use tls=true in the URI | true |
| Read preference | Which nodes to route read operations to | primary |
| Connection timeout | Seconds to wait for connection | 10 |
Required permissions
| Role | Purpose |
|---|---|
readAnyDatabase | Analyze queries and index usage across all collections |
clusterMonitor | Access serverStatus, replSetGetStatus, and other diagnostic commands for performance metrics |
Agent capabilities
Once connected, Tony can:| Capability | Description |
|---|---|
| Query analysis | Identify slow queries, analyze execution plans with explain() |
| Index recommendations | Find missing indexes, identify unused indexes |
| Performance metrics | Monitor connections, memory usage, and replication lag |
Verify the connection
Example prompts
Troubleshooting
Authentication failed
Authentication failed
- Verify username and password are correct
- Ensure the user is created on the
admindatabase, or append?authSource=adminto your connection string - For Atlas: confirm the user was created with the correct privileges under Database Access
Connection refused or timeout
Connection refused or timeout
- Check that CloudThinker IPs are added to your Atlas Network Access list or your firewall
- For local MongoDB, ensure
bindIpinmongod.confis not set to only127.0.0.1
Security
- Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
- Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
- Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
- Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
- TLS required — always use
tls=truein the connection string to encrypt data in transit. - Minimal roles — grant only
readAnyDatabaseandclusterMonitor; never grant write or admin roles.
Related
Tony Agent
Database-focused optimization agent
PostgreSQL Connection
Setup instructions for PostgreSQL databases