Back to Integrations
MongoDB logo

MongoDB Integration

MongoDB 4.4+ with Atlas support

Automatically discover and classify PII fields in your MongoDB collections. Our AI analyzes document schemas and sample data to identify personal information like emails, phone numbers, Aadhaar numbers, and nested PII — helping you build your DPDP data map.

Prerequisites

MongoDB Atlas (Recommended)

  • Add our IP addresses to your Atlas IP Access List
  • Create a database user with read-only permissions
  • Copy your connection string from Atlas dashboard

Self-Hosted MongoDB

  • MongoDB server must be accessible from the internet (or whitelist our IPs)
  • Port 27017 (or your custom port) must be open
  • TLS/SSL enabled (recommended)

Database User Setup

Create a read-only user with minimal privileges:

// Connect to your MongoDB instance
use admin

// Create a read-only user for Privacy Labs
db.createUser({
  user: "privacylabs_scanner",
  pwd: "your_secure_password",
  roles: [
    { role: "read", db: "your_database" }
  ]
})

// For scanning multiple databases:
db.createUser({
  user: "privacylabs_scanner",
  pwd: "your_secure_password",
  roles: [
    { role: "readAnyDatabase", db: "admin" }
  ]
})

Minimum Privileges Required

Required

  • read role on target database
  • listCollections action
  • find action on collections

Not Required

  • insert, update, remove
  • createCollection, dropCollection
  • dbAdmin or userAdmin roles

Step-by-Step Setup

1

Navigate to Integrations

In your admin dashboard, go to Data Discovery → Integrations and click Add Connection.

2

Select MongoDB

Choose MongoDB from the list of supported databases.

3

Enter Connection String

Paste your MongoDB connection string. For Atlas, copy it from the "Connect" dialog.

# MongoDB Atlas format
mongodb+srv://privacylabs_scanner:<password>@cluster0.xxxxx.mongodb.net/your_database

# Self-hosted format
mongodb://privacylabs_scanner:<password>@your-server.com:27017/your_database?ssl=true
4

Test Connection

Click Test Connection to verify credentials. If successful, click Save.

5

Run Discovery Scan

Go to Data Discovery → Run Discovery, select your MongoDB connection, and start the scan.

What We Scan vs. What We Don't

What We Scan

  • Collection list: Names of all collections in the database
  • Document schema: Field names, types, and nested structures
  • Sample documents: Up to 100 documents per collection
  • Nested PII: We detect PII in embedded documents and arrays

What We Never Touch

  • Full exports: We never download entire collections
  • Write operations: No insert, update, or delete
  • Admin operations: No collection or index changes
  • Data storage: Samples analyzed in-memory only

MongoDB-specific: We handle schema-less documents by analyzing multiple samples to build a comprehensive field map. Nested objects and arrays are fully traversed to detect deeply embedded PII.

Security

Encrypted Credentials

Connection strings encrypted with AES-256 at rest.

TLS Connections

All connections use TLS encryption in transit.

Atlas Compatible

Works with MongoDB Atlas IP Access Lists.

Audit Logged

All scan activities are logged for compliance.

Ready to Scan Your MongoDB Database?

Connect in under 5 minutes and discover PII fields automatically.

Book a Demo