🍃🔎 MongoDB Lens: Full Featured MCP Server for MongoDB Databases
MongoDB Lens is a local Model Context Protocol (MCP) server with full featured access to MongoDB databases using natural language via LLMs to perform queries, run aggregations, optimize performance, and more.
aggregate-data
: Execute aggregation pipelinesanalyze-query-patterns
: Analyze live queries and suggest optimizationsanalyze-schema
: Automatically infer collection schemasbulk-operations
: Perform multiple operations efficiently (requires confirmation for destructive operations)collation-query
: Find documents with language-specific collation rulescompare-schemas
: Compare schemas between two collectionsconnect-mongodb
: Connect to a different MongoDB URIconnect-original
: Connect back to the original MongoDB URI used at startupcount-documents
: Count documents matching specified criteriacreate-collection
: Create new collections with custom optionscreate-database
: Create a new database with option to switch to itcreate-index
: Create new indexes for performance optimizationcreate-timeseries
: Create time series collections for temporal datacreate-user
: Create new database users with specific rolescurrent-database
: Show the current database contextdelete-document
: Delete documents matching specified criteria (requires confirmation)distinct-values
: Extract unique values for any fielddrop-collection
: Remove collections from the database (requires confirmation)drop-database
: Drop a database (requires confirmation)drop-index
: Remove indexes from collections (requires confirmation)drop-user
: Remove database users (requires confirmation)explain-query
: Analyze query execution plansexport-data
: Export query results in JSON or CSV formatfind-documents
: Run queries with filters, projections, and sortinggenerate-schema-validator
: Generate JSON Schema validatorsgeo-query
: Perform geospatial queries with various operatorsget-stats
: Retrieve database or collection statisticsgridfs-operation
: Manage large files with GridFS bucketslist-collections
: Explore collections in the current databaselist-connections
: View all available MongoDB connection aliaseslist-databases
: View all accessible databasesmap-reduce
: Run MapReduce operations for complex data processingmodify-document
: Insert or update specific documentsrename-collection
: Rename existing collections (requires confirmation when dropping targets)shard-status
: View sharding configuration for databases and collectionstext-search
: Perform full-text search across text-indexed fieldstransaction
: Execute multiple operations in a single ACID transactionuse-database
: Switch to a specific database contextvalidate-collection
: Check for data inconsistencieswatch-changes
: Monitor real-time changes to collectionscollection-indexes
: Index information for a collectioncollection-schema
: Schema information for a collectioncollection-stats
: Performance statistics for a collectioncollection-validation
: Validation rules for a collectioncollections
: List of collections in the current databasedatabase-triggers
: Database change streams and event triggers configurationdatabase-users
: Database users and roles in the current databasedatabases
: List of all accessible databasesperformance-metrics
: Real-time performance metrics and profiling datareplica-status
: Replica set status and configurationserver-status
: Server status informationstored-functions
: Stored JavaScript functions in the current databaseaggregation-builder
: Step-by-step creation of aggregation pipelinesbackup-strategy
: Customized backup and recovery recommendationsdata-modeling
: Expert advice on MongoDB schema design for specific use casesdatabase-health-check
: Comprehensive database health assessment and recommendationsindex-recommendation
: Get personalized index suggestions based on query patternsmigration-guide
: Step-by-step MongoDB version migration plansmongo-shell
: Generate MongoDB shell commands with explanationsmulti-tenant-design
: Design MongoDB multi-tenant database architecturequery-builder
: Interactive guidance for constructing MongoDB queriesquery-optimizer
: Optimization recommendations for slow queriesschema-analysis
: Detailed collection schema analysis with recommendationsschema-versioning
: Manage schema evolution in MongoDB applicationssecurity-audit
: Database security analysis and improvement recommendationssql-to-mongodb
: Convert SQL queries to MongoDB aggregation pipelinesMongoDB Lens includes numerous other features:
~/.mongodb-lens.[jsonc|json]
process.env.CONFIG_*
MongoDB Lens inserts a metadata
collection into each database it creates.
This metadata
collection stores a single document containing contextual information serving as a permanent record of the database's origin while ensuring the new and otherwise empty database persists in MongoDB's storage system.
{
"_id" : ObjectId("67d5284463788ec38aecee14"),
"created" : {
"timestamp" : ISODate("2025-03-15T07:12:04.705Z"),
"tool" : "MongoDB Lens v5.0.7",
"user" : "anonymous"
},
"mongodb" : {
"version" : "3.6.23",
"connectionInfo" : {
"host" : "unknown",
"readPreference" : "primary"
}
},
"database" : {
"name" : "example_database",
"description" : "Created via MongoDB Lens"
},
"system" : {
"hostname" : "unknown",
"platform" : "darwin",
"nodeVersion" : "v22.14.0"
},
"lens" : {
"version" : "5.0.7",
"startTimestamp" : ISODate("2025-03-15T07:10:06.084Z")
}
}
Once you've added your own collections to your new database, you can safely remove the metadata
collection via the drop-collection
tool:
drop-collection
tool (with confirmation)MongoDB Lens can be installed and run in several ways:
The easiest way to run MongoDB Lens is using npx
.
First, ensure Node.js is installed:
node --version # Ideally >= v22.x but MongoDB Lens is >= v18.x compatible
Then, run MongoDB Lens via NPX:
# Using default connection string mongodb://localhost:27017
npx -y mongodb-lens
# Using custom connection string
npx -y mongodb-lens mongodb://your-connection-string
# Using "@latest" to keep the package up-to-date
npx -y mongodb-lens@latest
TIP
If you encounter permissions errors with npx
try running npx clear-npx-cache
prior to running npx -y mongodb-lens
(this clears the cache and re-downloads the package).
NOTE
Docker Hub requires Docker installed and running on your system.
First, ensure Docker is installed:
docker --version # Ideally >= v27.x
Then, run MongoDB Lens via Docker Hub:
# Using default connection string mongodb://localhost:27017
docker run --rm -i --network=host furey/mongodb-lens
# Using custom connection string
docker run --rm -i --network=host furey/mongodb-lens mongodb://your-connection-string
# Using "--pull" to keep the Docker image up-to-date
docker run --rm -i --network=host --pull=always furey/mongodb-lens
NOTE
Node.js from source requires Node.js installed and running on your system (suggestion: use Volta).
git clone https://github.com/furey/mongodb-lens.git
cd /path/to/mongodb-lens
node --version # Ideally >= v22.x but MongoDB Lens is >= v18.x compatible
npm ci
# Using default connection string mongodb://localhost:27017
node mongodb-lens.js
# Using custom connection string
node mongodb-lens.js mongodb://your-connection-string
NOTE
Docker from source requires Docker installed and running on your system.
git clone https://github.com/furey/mongodb-lens.git
cd /path/to/mongodb-lens
docker --version # Ideally >= v27.x
docker build -t mongodb-lens .
# Using default connection string mongodb://localhost:27017
docker run --rm -i --network=host mongodb-lens
# Using custom connection string
docker run --rm -i --network=host mongodb-lens mongodb://your-connection-string
To verify the installation, paste and run the following jsonrpc message into the server's stdio:
{"method":"resources/read","params":{"uri":"mongodb://databases"},"jsonrpc":"2.0","id":1}
The server should respond with a list of databases in your MongoDB instance, for example:
{"result":{"contents":[{"uri":"mongodb://databases","text":"Databases (12):\n- admin (180.00 KB)\n- config (108.00 KB)\n- local (40.00 KB)\n- sample_airbnb (51.88 MB)\n- sample_analytics (9.46 MB)\n- sample_geospatial (980.00 KB)\n- sample_guides (40.00 KB)\n- sample_mflix (108.90 MB)\n- sample_restaurants (7.73 MB)\n- sample_supplies (968.00 KB)\n- sample_training (40.85 MB)\n- sample_weatherdata (2.69 MB)"}]},"jsonrpc":"2.0","id":1}
MongoDB Lens is now installed and ready to accept MCP requests.
The server accepts a MongoDB connection string as its only argument.
Example NPX usage:
npx -y mongodb-lens@latest mongodb://your-connection-string
MongoDB connection strings have the following format:
mongodb://[username:password@]host[:port][/database][?options]
Example connection strings:
mongodb://localhost:27017
mydatabase
with credentials from admin
database:mongodb://username:password@hostname:27017/mydatabase?authSource=admin
mydatabase
with various other options:mongodb://hostname:27017/mydatabase?retryWrites=true&w=majority
If no connection string is provided, the server will attempt to connect via local connection.
MongoDB Lens supports extensive customization via JSON configuration file.
NOTE
The config file is optional. MongoDB Lens will run with default settings if no config file is provided.
TIP
You only need to include the settings you want to customize in the config file. MongoDB Lens will use default settings for any omitted values.
TIP
MongoDB Lens supports both .json
and .jsonc
(JSON with comments) config file formats.
{
"mongoUri": "mongodb://localhost:27017", // Default MongoDB connection string or object of alias-URI pairs
"connectionOptions": {
"maxPoolSize": 20, // Maximum number of connections in the pool
"retryWrites": false, // Whether to retry write operations
"useNewUrlParser": true, // Use MongoDB's new URL parser
"connectTimeoutMS": 30000, // Connection timeout in milliseconds
"socketTimeoutMS": 360000, // Socket timeout in milliseconds
"useUnifiedTopology": true, // Use the new unified topology engine
"heartbeatFrequencyMS": 10000, // How often to ping servers for status
"serverSelectionTimeoutMS": 30000 // Timeout for server selection
},
"defaultDbName": "admin", // Default database if not specified in URI
"connection": {
"maxRetries": 5, // Maximum number of initial connection attempts
"maxRetryDelayMs": 30000, // Maximum delay between retries
"reconnectionRetries": 10, // Maximum reconnection attempts if connection lost
"initialRetryDelayMs": 1000 // Initial delay between retries
},
"disabled": {
"tools": [], // List of tools to disable or true to disable all
"prompts": [], // List of prompts to disable or true to disable all
"resources": [] // List of resources to disable or true to disable all
},
"cacheTTL": {
"stats": 15000, // Stats cache lifetime in milliseconds
"schemas": 60000, // Schema cache lifetime in milliseconds
"indexes": 120000, // Index cache lifetime in milliseconds
"collections": 30000, // Collections list cache lifetime in milliseconds
"serverStatus": 20000 // Server status cache lifetime in milliseconds
},
"enabledCaches": [ // List of caches to enable
"stats", // Statistics cache
"fields", // Collection fields cache
"schemas", // Collection schemas cache
"indexes", // Collection indexes cache
"collections", // Database collections cache
"serverStatus" // MongoDB server status cache
],
"memory": {
"enableGC": true, // Whether to enable garbage collection
"warningThresholdMB": 1500, // Memory threshold for warnings
"criticalThresholdMB": 2000 // Memory threshold for cache clearing
},
"logLevel": "info", // Log level (info or verbose)
"disableDestructiveOperationTokens": false, // Whether to skip confirmation for destructive ops
"watchdogIntervalMs": 30000, // Interval for connection monitoring
"defaults": {
"slowMs": 100, // Threshold for slow query detection
"queryLimit": 10, // Default limit for query results
"allowDiskUse": true, // Allow operations to use disk for large datasets
"schemaSampleSize": 100, // Sample size for schema inference
"aggregationBatchSize": 50 // Batch size for aggregation operations
},
"security": {
"tokenLength": 4, // Length of confirmation tokens
"tokenExpirationMinutes": 5, // Expiration time for tokens
"strictDatabaseNameValidation": true // Enforce strict database name validation
},
"tools": {
"transaction": {
"readConcern": "snapshot", // Read concern level for transactions
"writeConcern": {
"w": "majority" // Write concern for transactions
}
},
"bulkOperations": {
"ordered": true // Whether bulk operations execute in order
},
"export": {
"defaultLimit": -1, // Default limit for exports (-1 = no limit)
"defaultFormat": "json" // Default export format (json or csv)
},
"watchChanges": {
"maxDurationSeconds": 60, // Maximum duration for change streams
"defaultDurationSeconds": 10 // Default duration for change streams
},
"queryAnalysis": {
"defaultDurationSeconds": 10 // Default duration for query analysis
}
}
}
By default, MongoDB Lens looks for the config file at:
~/.mongodb-lens.jsonc
first, then falls back to~/.mongodb-lens.json
if the former doesn't existTo customize the config file path, set the environment variable CONFIG_PATH
to the desired file path.
Example NPX usage:
CONFIG_PATH='/path/to/config.json' npx -y mongodb-lens@latest
Example Docker Hub usage:
docker run --rm -i --network=host --pull=always -v /path/to/config.json:/root/.mongodb-lens.json furey/mongodb-lens
You can generate a configuration file automatically using the config:create
script:
# Create config file
npm run config:create
# Create config file (force overwrite existing)
npm run config:create -- --force
This script extracts the example configuration file above and saves it to: ~/.mongodb-lens.jsonc
You can specify a custom configuration file output location using the CONFIG_PATH
environment variable:
# Save to a specific file path
CONFIG_PATH=/path/to/config.jsonc npm run config:create
# Save to a specific directory (will append .mongodb-lens.jsonc to the path)
CONFIG_PATH=/path/to/directory npm run config:create
# Save as JSON without comments
CONFIG_PATH=/path/to/config.json npm run config:create
The script handles paths intelligently:
CONFIG_PATH
has no file extension, it's treated as a directory and .mongodb-lens.jsonc
is appendedCONFIG_PATH
ends with .json
(not .jsonc
), comments are automatically stripped from the outputMongoDB Lens supports multiple MongoDB URIs with aliases in your config file, allowing you to easily switch between different MongoDB instances using simple names.
To configure multiple connections, set the mongoUri
config setting to an object with alias-URI pairs:
{
"mongoUri": {
"main": "mongodb://localhost:27017",
"backup": "mongodb://localhost:27018",
"atlas": "mongodb+srv://username:[email protected]/mydb"
}
}
With this configuration:
main
) becomes the default connection at startup"Connect to backup"
or "Connect to atlas"
"Connect to mongodb://localhost:27018"
list-connections
tool shows all available connection aliasesNOTE
When using the command-line argument to specify a connection, you can use either a full MongoDB URI or an alias defined in your configuration file.
MongoDB Lens supports environment variable overrides for configuration settings.
Environment variables take precedence over config file settings.
Config environment variables follow the naming pattern:
CONFIG_[SETTING PATH, SNAKE CASED, UPPERCASED]
Example overrides:
Config Setting | Environment Variable Override |
---|---|
mongoUri | CONFIG_MONGO_URI |
logLevel | CONFIG_LOG_LEVEL |
defaultDbName | CONFIG_DEFAULT_DB_NAME |
connectionOptions.maxPoolSize | CONFIG_CONNECTION_OPTIONS_MAX_POOL_SIZE |
connection.reconnectionRetries | CONFIG_CONNECTION_RECONNECTION_RETRIES |
defaults.queryLimit | CONFIG_DEFAULTS_QUERY_LIMIT |
tools.export.defaultFormat | CONFIG_TOOLS_EXPORT_DEFAULT_FORMAT |
For environment variable values:
'true'
or 'false'
.Example NPX usage:
CONFIG_DEFAULTS_QUERY_LIMIT='25' npx -y mongodb-lens@latest
Example Docker Hub usage:
docker run --rm -i --network=host --pull=always -e CONFIG_DEFAULTS_QUERY_LIMIT='25' furey/mongodb-lens
For consistent environment variable usage across Windows, macOS, and Linux, consider using cross-env
:
# Using NPM
npm install -g cross-env
# Using Volta (see: https://volta.sh)
volta install cross-env
# Example NPX usage with cross-env
cross-env CONFIG_DEFAULTS_QUERY_LIMIT='25' npx -y mongodb-lens@latest
# Example Node.js usage with cross-env
cross-env CONFIG_DEFAULTS_QUERY_LIMIT='25' node mongodb-lens.js
To use MongoDB Lens with Claude Desktop:
claude_desktop_config.json
(create if it doesn't exist):
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
For each option:
mongodb://your-connection-string
with your MongoDB connection string or omit it to use the default mongodb://localhost:27017
.CONFIG_PATH
environment variable."env": {}
with key-value pairs, for example:"command": "/path/to/npx",
"args": [
"-y",
"mongodb-lens@latest",
"mongodb://your-connection-string"
],
"env": {
"CONFIG_LOG_LEVEL": "verbose"
}
-e
flags, for example:"command": "docker",
"args": [
"run", "--rm", "-i",
"--network=host",
"--pull=always",
"-e", "CONFIG_LOG_LEVEL='verbose'",
"furey/mongodb-lens",
"mongodb://your-connection-string"
]
{
"mcpServers": {
"mongodb-lens": {
"command": "/path/to/npx",
"args": [
"-y",
"mongodb-lens@latest",
"mongodb://your-connection-string"
]
}
}
}
{
"mcpServers": {
"mongodb-lens": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"--network=host",
"--pull=always",
"furey/mongodb-lens",
"mongodb://your-connection-string"
]
}
}
}
{
"mcpServers": {
"mongodb-lens": {
"command": "/path/to/node",
"args": [
"/path/to/mongodb-lens.js",
"mongodb://your-connection-string"
]
}
}
}
{
"mcpServers": {
"mongodb-lens": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"--network=host",
"mongodb-lens",
"mongodb://your-connection-string"
]
}
}
}
MCP Inspector is a tool designed for testing and debugging MCP servers.
NOTE
MCP Inspector starts a proxy server on port 3000 and web client on port 5173.
Example NPX usage:
# Using default connection string mongodb://localhost:27017
npx -y @modelcontextprotocol/inspector npx -y mongodb-lens@latest
# Using custom connection string
npx -y @modelcontextprotocol/inspector npx -y mongodb-lens@latest mongodb://your-connection-string
# Using custom ports
SERVER_PORT=1234 CLIENT_PORT=5678 npx -y @modelcontextprotocol/inspector npx -y mongodb-lens@latest
MCP Inspector should support the full range of MongoDB Lens capabilities, including autocompletion for collection names and query fields.
For more, see: MCP Inspector
MongoDB Lens should be usable with any MCP-compatible client.
For more, see: MCP Documentation: Example Clients
To protect your data while using MongoDB Lens, consider the following:
When connecting MongoDB Lens to your database, the permissions granted to the user in the MongoDB connection string dictate what actions can be performed. When the use case fits, a read-only user can prevent unintended writes or deletes, ensuring MongoDB Lens can query data but not alter it.
To set this up, create a user with the read
role scoped to the database(s) you're targeting. In MongoDB shell, you'd run something like:
use admin
db.createUser({
user: 'readonly',
pwd: 'eXaMpLePaSsWoRd',
roles: [{ role: 'read', db: 'mydatabase' }]
})
Then, apply those credentials to your MongoDB connection string:
mongodb://readonly:eXaMpLePaSsWoRd@localhost:27017/mydatabase
Using read-only credentials is a simple yet effective way to enforce security boundaries, especially when you're poking around schemas or running ad-hoc queries.
When working with MongoDB Lens, consider connecting to a backup copy of your data hosted on a separate MongoDB instance.
Start by generating the backup with mongodump
. Next, spin up a fresh MongoDB instance (e.g. on a different port like 27018
) and restore the backup there using mongorestore
. Once it's running, point MongoDB Lens to the backup instance's connection string (e.g. mongodb://localhost:27018/mydatabase
).
This approach gives you a sandbox to test complex or destructive operations against without risking accidental corruption of your live data.
MongoDB Lens implements a token-based confirmation system for potentially destructive operations, requiring a two-step process to execute tools that may otherwise result in unchecked data loss:
For an example of the confirmation process, see: Working with Confirmation Protection
Tools that require confirmation include:
drop-user
: Remove a database userdrop-index
: Remove an index (potential performance impact)drop-database
: Permanently delete a databasedrop-collection
: Delete a collection and all its documentsdelete-document
: Delete one or multiple documentsbulk-operations
: When including delete operationsrename-collection
: When the target collection exists and will be droppedThis protection mechanism aims to prevent accidental data loss from typos and unintended commands. It's a safety net ensuring you're aware of the consequences before proceeding with potentially harmful actions.
NOTE
If you're working in a controlled environment where data loss is acceptable, you can configure MongoDB Lens to bypass confirmation and perform destructive operations immediately.
You might want to bypass the token confirmation system.
Set the environment variable CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS
to true
to execute destructive operations immediately without confirmation:
# Using NPX
CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS=true npx -y mongodb-lens@latest
# Using Docker
docker run --rm -i --network=host --pull=always -e CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS='true' furey/mongodb-lens
WARNING
Disabling confirmation tokens removes an important safety mechanism. It's strongly recommended to only use this option in controlled environments where data loss is acceptable, such as development or testing. Disable at your own risk.
MongoDB Lens includes several tools that can modify or delete data. To disable specific tools, add them to the disabled.tools
array in your configuration file:
{
"disabled": {
"tools": [
"drop-user",
"drop-index",
"drop-database",
"drop-collection",
"delete-document",
"bulk-operations",
"rename-collection"
]
}
}
These tools can cause immediate data loss and should be considered for disabling in sensitive environments:
drop-user
: Removes database users and their access permissionsdrop-index
: Removes indexes (can impact query performance)drop-database
: Permanently deletes entire databasesdrop-collection
: Permanently deletes collections and all their documentsdelete-document
: Removes documents matching specified criteriabulk-operations
: Can perform batch deletions when configured to do sorename-collection
: Can overwrite existing collections when using the drop target optionThese tools can modify data but typically don't cause immediate data loss:
create-user
: Creates users with permissions that could enable further changestransaction
: Executes multiple operations in a transaction (potential for complex changes)modify-document
: Inserts or updates documents which could overwrite existing dataFor a complete read-only configuration, disable all potentially destructive tools:
{
"disabled": {
"tools": [
"drop-user",
"drop-index",
"create-user",
"transaction",
"create-index",
"drop-database",
"drop-collection",
"delete-document",
"modify-document",
"bulk-operations",
"create-database",
"gridfs-operation",
"create-collection",
"rename-collection",
"create-timeseries"
]
}
}
This configuration allows MongoDB Lens to query and analyze data while preventing any modifications, providing multiple layers of protection against accidental data loss.
This following tutorial guides you through setting up a MongoDB container with sample data, then using MongoDB Lens to interact with it through natural language queries:
NOTE
This tutorial assumes you have Docker installed and running on your system.
IMPORTANT
If Docker is already running a container on port 27017, stop it before proceeding.
docker run --name mongodb-sampledata -d -p 27017:27017 mongo:6
docker ps | grep mongodb-sampledata
MongoDB provides several sample datasets which we'll use to explore MongoDB Lens.
curl -LO https://atlas-education.s3.amazonaws.com/sampledata.archive
docker cp sampledata.archive mongodb-sampledata:/tmp/
docker exec -it mongodb-sampledata mongorestore --archive=/tmp/sampledata.archive
This will import several databases:
sample_airbnb
: Airbnb listings and reviewssample_analytics
: Customer and account datasample_geospatial
: Geographic datasample_mflix
: Movie datasample_restaurants
: Restaurant datasample_supplies
: Supply chain datasample_training
: Training data for various applicationssample_weatherdata
: Weather measurementsInstall MongoDB Lens as per the Quick Start instructions.
Set your MCP Client to connect to MongoDB Lens via: mongodb://localhost:27017
TIP
Omitting the connection string from your MCP Client configuration will default the connection string to mongodb://localhost:27017
.
Example Claude Desktop configuration:
{
"mcpServers": {
"mongodb-lens": {
"command": "/path/to/npx",
"args": [
"-y",
"mongodb-lens@latest"
]
}
}
}
With your MCP Client running and connected to MongoDB Lens, try the following example queries:
list-databases
toolcurrent-database
tooluse-database
toolcreate-database
toolcreate-database
tool with switch=truedrop-database
tool (with confirmation)list-collections
toolcreate-collection
tooldrop-collection
tool (with confirmation)rename-collection
toolvalidate-collection
toolcreate-user
tooldrop-user
tool (with confirmation)count-documents
toolfind-documents
toolaggregate-data
tooldistinct-values
tooltext-search
toolcollation-query
toolanalyze-schema
toolcompare-schemas
toolgenerate-schema-validator
toolanalyze-query-patterns
toolmodify-document
tool (insert operation)modify-document
tool (update operation)delete-document
tool (with confirmation)bulk-operations
toolcreate-index
tooldrop-index
tool (with confirmation)explain-query
toolget-stats
tool (database target)get-stats
tool (collection target)geo-query
tool'function () { emit(this.year, 1) }'
and reduce 'function (key, values) { return Array.sum(values) }'
"map-reduce
tooltransaction
toolcreate-timeseries
toolwatch-changes
toolgridfs-operation
tool (list operation)export-data
toolshard-status
toolconnect-mongodb
toolconnect-mongodb
toolconnect-original
toolconnect-mongodb
tool with validateConnection=falseMongoDB Lens includes a safety mechanism for potentially destructive operations. Here's how it works in practice:
"Drop the collection named test_collection"
⚠️ DESTRUCTIVE OPERATION WARNING ⚠️
You've requested to drop the collection 'test_collection'.
This operation is irreversible and will permanently delete all data in this collection.
To confirm, you must type the 4-digit confirmation code EXACTLY as shown below:
Confirmation code: 9876
This code will expire in 5 minutes for security purposes.
"9876"
Collection 'test_collection' has been permanently deleted.
This two-step process prevents accidental data loss by requiring explicit confirmation.
NOTE
If you're working in a controlled environment where data loss is acceptable, you can configure MongoDB Lens to bypass confirmation and perform destructive operations immediately.
MongoDB Lens:
If you've found MongoDB Lens helpful consider supporting my work through:
Buy Me a Coffee | GitHub Sponsorship
Contributions help me continue developing and improving this tool, allowing me to dedicate more time to add new features and ensuring it remains a valuable resource for the community.