MongoDB
Connect a MongoDB database to DashX. Once installed, you can sync its collections into Resources and read and write documents through the DashX API.
Prerequisites
Before setting up the MongoDB integration, ensure you have:
- An active DashX account
- A running MongoDB deployment reachable from the internet
- Credentials for a database user DashX can connect as
Prepare a database user
Create a dedicated user for DashX rather than reusing an application or admin account, and give it a role scoped to the single database you want to expose — read if you only intend to query, readWrite if DashX should also modify documents.
db.createUser({
user: "dashx",
pwd: "a-strong-password",
roles: [ { role: "read", db: "your_database" } ]
})
If you are using MongoDB Atlas, create the user under Database Access instead and assign it the same scoped role.
Allow network access
Your deployment must accept connections from DashX. On Atlas this means adding an entry under Network Access; on a self-hosted deployment it means adjusting the relevant firewall or security group rule.
Connect to DashX
- Log in to your DashX workspace
- Navigate to Settings > Integrations
- Click [+] to add a new integration and select MongoDB
- Choose the environments you want to enable it for
- Enter the configuration below and save
Configuration
| Field | Description |
|---|---|
| Host | Hostname of the MongoDB deployment. |
| Port | Port the deployment listens on. MongoDB defaults to 27017. |
| User | The database user DashX connects as. |
| Password | Password for that user. |
| Database Name | The database to connect to. |
Sync your collections
With the integration installed, open Data > Overview and choose Sync Database to read the structure and turn collections into resources. See Resources for the full flow.
MongoDB documents in the same collection can have differing shapes. Review the attributes DashX infers after syncing, and adjust them where the inferred type is not what you want.
Related: the Database Hub app.