MongoDB
Connect a MongoDB cluster or MongoDB Atlas deployment to TraceX with a read-only user, and learn how its queries are checked and time-limited.
Connect a MongoDB cluster or MongoDB Atlas deployment with a read-only user.
Why connect MongoDB
Section titled “Why connect MongoDB”Issues are usually about specific documents: a user, an order, a subscription. With MongoDB connected, TraceX looks them up by id, email or any field in the issue, checks their state and counts how many others look the same, and uses that as evidence for the root cause.
Before you start
Section titled “Before you start”Create a database user with the built-in read role on the database TraceX should
see:
-
Atlas: Database Access → Add new database user → Built-in role: Only read any database, or a custom role with
readon one database. -
Self-managed:
db.getSiblingDB("admin").createUser({user: "tracex_readonly",pwd: "<strong password>",roles: [{ role: "read", db: "production" }],});
If your cluster restricts Network Access (an IP access list), contact TraceX support about the addresses to allow.
Connect
Section titled “Connect”In the dashboard, open Integrations → MongoDB and fill in:
| Field | Value |
|---|---|
| Connection URI | mongodb+srv://tracex_readonly:<password>@cluster0.mongodb.net |
| Database | production |
TraceX tests the connection, reads the collections and their fields, and is ready for investigations. The URI is stored encrypted and never shown again.
How TraceX queries it
Section titled “How TraceX queries it”Every query TraceX writes is checked before it runs:
- it must be a single read-only statement: no writes, no schema changes, no
$outor$merge; - it runs in a time-limited read (
maxTimeMS) with row and time limits, so a query can’t slow your database down; - results are summarized for the investigation, and secrets in them are masked before an AI model sees them.
TraceX also reads the schema (tables or collections, columns or fields) when you connect, so it writes queries against names that really exist. Add notes about what a table is for in the company profile: they help it pick the right table first time.
Troubleshooting
Section titled “Troubleshooting”| Problem | What to check |
|---|---|
| Connection times out | The database must be reachable from the internet. If it only accepts known addresses or sits in a private network, contact support about network access before connecting. |
| Authentication failed | Re-check the username and password or key, and that the user is allowed to sign in from outside your network. |
| Connected, but collections are missing | The user needs the read role on that database. |
| Answers use the wrong table | Add a note about what each table is for in the company profile. |
Remove access
Section titled “Remove access”Disconnect MongoDB in Integrations, and delete the database user in Atlas or with
db.dropUser("tracex_readonly").