Retool supports connecting to both managed and self-hosted MongoDB databases, including MongoDB Atlas Clusters and AWS DocumentDB. Retool uses version 4.1 of the MongoDB Node driver.
All users for Retool organizations on Free or Team plans have global Edit permissions and can add, edit, and remove resources. If your organization manages user permissions for resources, you must be a member of a group with Edit all permissions.
To create your MongoDB resource, you need to know:
- Your MongoDB host.
- The connection format you want to use (Standard or DNS seed list).
- The Mongo version your database uses.
The connection format you choose determines the fields required to create the resource. You might also need a port number, default database, a username, and a password.
If MongoDB is behind a firewall, you must also allow access from Retool's IP addresses. Add these IP addresses to your firewall's allowlist before you create the resource.
1. Create a MongoDB resource
2. Configure the resource
Provide the necessary details to configure the resource so Retool can connect to MongoDB. Not all settings are required but refer to the MongoDB documentation to learn what is needed.
These settings configure the name and location of the resource within Retool.
The name to use for the resource (e.g., MongoDB).
The folder in which to save the resource.
A brief description of the resource (e.g., Customer data).
These settings configure how Retool connects to MongoDB. You can configure the credentials manually or with a connection string.
|Host||The URL or IP address.|
|Connection format||The connection format used to connect to MongoDB. Options include |
|Port||The port number. Only required when using the |
|Default database||The name of the default database.|
|Database username||Your database username.|
|Database password||The password of the database user.|
|Mongo version||The range of supported MongoDB versions.|
|Connection options||Additional options for the MySQL connection.|
|Use SSL/TLS||Connect to your database with SSL/TLS.|
You can also configure the following advanced settings for MongoDB resources.
|SSH tunnel||Enable SSH tunneling through bastion host.|
3. Save the resource
Click Create resource to complete the setup. You can then click either Create an app to immediately start building a Retool app or Back to resources to return to the list of resources.
Your MongoDB resource is now ready to use. To interact with MongoDB data, select the resource in the query editor. Retool supports v2 of MongoDB's Extended JSON syntax.