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

Credential
Description
Example

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

circle-info

For MongoDB Atlas (cloud), you'll typically use a connection string format. The host will be your cluster address, and the default port is usually handled automatically.

Finding Your Credentials

For MongoDB Atlas

  1. Navigate to your cluster and click Connect

  2. Select Connect your application

  3. 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)

  1. Go to Database Access in the left sidebar

  2. Click Add New Database User

  3. Choose Password authentication

  4. Set a username and strong password

  5. Under Database User Privileges, select Read only to any database for Memex access

  6. Click Add User

Connecting to Memex

  1. Open the Memex Hub from the sidebar

  2. Click on the Connectors tab

  3. Find and click the MongoDB card

  4. Enter your Host, Port, Username, and Password

  5. Give your connection a memorable name (e.g., "Production MongoDB")

  6. 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:

circle-exclamation

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?