Prerequisites
Connection Methods
Choose the connection method that best fits your MongoDB setup.
Connection String
Use a MongoDB connection string for quick setup with authentication.
Manual Configuration
Configure host, port, database, and authentication separately.
Atlas Cloud
Connect directly to MongoDB Atlas with cluster connection strings.
Connection Guide
Step 1: Access MongoDB Integration
Navigate to Integrations in Datapad and select MongoDB:
Step 2: Enter Connection Details
Choose your preferred connection method and enter details:
Connection String Format:
mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
Required Information:
- Connection String or Host/Port
- Database Name
- Username and Password
- Authentication Database (if different)
Step 3: Configure Collection Access
Select which collections you want to analyze:
Available Options:
- All Collections (recommended for full analysis)
- Specific Collections (for focused analysis)
- Collection Patterns (using regex matching)
Create Read-Only User (Recommended)
For security, create a dedicated user with read-only permissions:
// Connect to your MongoDB instance
use admin
// Create a read-only user for Datapad
db.createUser({
user: "datapad_readonly",
pwd: "secure_password",
roles: [
{ role: "read", db: "your_database" },
{ role: "read", db: "your_other_database" }
]
})
Example Queries
Here are some example questions you can ask once your MongoDB data is connected:
💬 NoSQL Query Tips
Behind the Scenes
Datapad connects to your MongoDB database and analyzes document structures, field distributions, and data patterns. Our AI understands NoSQL document relationships and generates optimized aggregation pipelines for complex queries, providing insights that are difficult to obtain with traditional MongoDB queries.
Troubleshooting
Connection failed
If MongoDB connection fails:
- Verify your connection string format is correct
- Check that your username and password are accurate
- Ensure the database is accessible from external connections
- Test connectivity using MongoDB Compass or mongo shell
Authentication error
If authentication fails:
- Verify the user has read permissions on the target databases
- Check that the authentication database is correctly specified
- Ensure the user account isn't locked or expired
- Try connecting with the same credentials using MongoDB client tools
Collection access issues
If specific collections aren't accessible:
- Verify the user has read permissions on those collections
- Check that collection names are spelled correctly
- Ensure collections contain documents for analysis
- Contact support if permissions appear correct but access still fails