MongoDB
Connect your MongoDB databases to Memex for AI-powered document data analysis.
What is MongoDB?
MongoDB is a popular NoSQL document database that stores data in flexible, JSON-like documents. It's commonly used for applications requiring scalable, high-performance data storage with dynamic schemas. Once connected, Memex can explore your collections, query documents, and help you analyze your MongoDB data through natural conversation.
What You'll Need
Host
MongoDB server hostname
cluster0.abc123.mongodb.net or localhost
Port
MongoDB server port
27017 (default)
Username
Database username
app_user
Password
Database password
Your secure password
Finding Your Credentials
For MongoDB Atlas
Log in to MongoDB Atlas
Navigate to your cluster and click Connect
Select Connect your application
Your connection details will be shown:
Host: Your cluster address (e.g.,
cluster0.abc123.mongodb.net)Use the database user credentials you created in the Database Access section
For Self-Hosted MongoDB
Contact your database administrator to obtain:
The server hostname or IP address
The port number (default is 27017)
A username and password with appropriate permissions
Creating a Database User (Atlas)
Go to Database Access in the left sidebar
Click Add New Database User
Choose Password authentication
Set a username and strong password
Under Database User Privileges, select Read only to any database for Memex access
Click Add User
Connecting to Memex
Open the Memex Hub from the sidebar
Click on the Connectors tab
Find and click the MongoDB card
Enter your Host, Port, Username, and Password
Give your connection a memorable name (e.g., "Production MongoDB")
Click Add Connection
Verifying Your Connection
Once connected, try asking Memex:
You should see a list of collections in your database.
Using Your Connection
Here are some examples of what you can ask:
Security Considerations
Authentication
MongoDB supports multiple authentication mechanisms. When using username/password authentication:
Create dedicated users for Memex with read-only access
Use strong, unique passwords
Never share the admin or root user credentials
Network Access
For MongoDB Atlas:
Configure Network Access to allow connections from Memex
Use IP allowlisting for additional security
Consider using VPC peering for production environments
For self-hosted MongoDB:
Ensure your firewall allows connections on the MongoDB port
Use TLS/SSL for encrypted connections
Bind MongoDB to specific network interfaces rather than all interfaces
User Permissions
Create a read-only user for Memex:
Avoid using users with readWriteAnyDatabase or root roles for Memex connections. Always follow the principle of least privilege.
Troubleshooting
Connection Refused
Verify the hostname and port are correct
For Atlas, ensure your IP address is in the Network Access allowlist
Check that MongoDB is running and accepting connections
Verify the connection string format is correct
Authentication Failed
Double-check your username and password
Ensure the user is created in the correct authentication database (usually
admin)Verify the user has access to the databases you're trying to query
Check if the password contains special characters that need escaping
No Collections Found
Verify you have collections in the database
Ensure the user has read permissions on the database
Check that you're connecting to the correct database
Timeout Errors
For Atlas, verify your network connection to the cluster
Check if the cluster is paused (free tier clusters pause after inactivity)
Ensure there are no network firewalls blocking the connection
Learn More
Last updated
Was this helpful?