Skip to main content
Connect your MongoDB databases to enable Tony (Database Engineer) to analyze queries, optimize performance, and monitor database health.

Supported platforms

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.
1

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.
2

Switch to the admin database

Ensure you are on the admin database where users are created:
3

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.
4

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
5

Add the connection in CloudThinker

Navigate to Connections → MongoDB and paste your connection string:
Include tls=true if your deployment enforces TLS encryption. Click Connect. CloudThinker shows a Connected status once it succeeds.

Connection details

Required permissions

Assign both roles to unlock full query analysis and cluster health monitoring. Never grant write or admin roles to the CloudThinker user.

Agent capabilities

Once connected, Tony can:

Verify the connection

Example prompts

Troubleshooting

  • Verify username and password are correct
  • Ensure the user is created on the admin database, or append ?authSource=admin to your connection string
  • For Atlas: confirm the user was created with the correct privileges under Database Access
  • Check that CloudThinker IPs are added to your Atlas Network Access list or your firewall
  • For local MongoDB, ensure bindIp in mongod.conf is not set to only 127.0.0.1
  • Tony needs the clusterMonitor role to run serverStatus and replSetGetStatus
  • Add the clusterMonitor role to the CloudThinker user on the admin database and reconnect

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=true in the connection string to encrypt data in transit.
  • Minimal roles — grant only readAnyDatabase and clusterMonitor; never grant write or admin roles.

Tony Agent

Database-focused optimization agent

PostgreSQL Connection

Setup instructions for PostgreSQL databases