How to Fix MongoDB Error 115 (CommandNotSupported)
You get mongodb error 115 when a client sends a command that the server rejects. To fix this, update the client request to use a valid command for your node. MongoDB names this failure CommandNotSupported in its official error list. It means the database engine parsed the request but cannot run that specific operation. This often happens during version upgrades, storage engine changes, or proxy routing mistakes. Fixing it takes a quick check of your app logic and cluster setup. What causes mo
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get mongodb error 115 when a client sends a command that the server rejects. To fix this, update the client request to use a valid command for your node.
MongoDB names this failure CommandNotSupported in its official error list. It means the database engine parsed the request but cannot run that specific operation. This often happens during version upgrades, storage engine changes, or proxy routing mistakes. Fixing it takes a quick check of your app logic and cluster setup.
What causes mongodb error 115 in your cluster
The database server returns code 115 when an operation does not match the node capabilities. A common cause is sending a replica set command to a standalone server. Another trigger is running an old command that a newer database version removed. Sometimes a client sends a sharding command directly to a data node instead of a router.
Storage engine limits also trigger the CommandNotSupported message. Some admin actions only work on specific storage backends or deployment tiers. Managed cloud clusters also block certain host commands to keep shared hardware safe. If a driver or migration tool runs those blocked actions, the server stops the request right away.
Client library mismatches create this issue in many production systems. An updated driver might send new wire protocol features to an older server. On the other hand, an old app might call removed features after a database upgrade. Checking the exact command name in your server logs reveals which part failed.
How to diagnose and fix the failure safely
Start by finding the rejected command in your database logs or app error trace. Do not grant full admin rights to fix a CommandNotSupported failure. Role checks happen separately from command support checks in the database engine. Adding broad privileges will not make an unsupported command work on the wrong node.
MongoDB grants access through roles that allow specific actions on defined resources. These roles apply to a database and work down to the collection level. If a user only needs to view data, assign the built-in read role. The read role allows actions like find, listCollections, listIndexes, dbStats, collStats, and changeStream.
Customer Support Access to Production + MongoDB Authentication & Authorization: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If the app needs to change records, use the readWrite role instead. It adds actions like insert, update, remove, createCollection, createIndex, dropIndex, and dropCollection. Keep these role rules tight while you fix the broken command in your code. Match your client driver version to your server version so every call uses supported commands.
Preventing unsupported commands in production
You can stop bad commands before they reach production by testing driver updates early. Run your app test suite against the exact database topology you use in production. If production uses a sharded cluster, do not test against a single standalone node. This catches routing mistakes that trigger code 115 during deploys.
When engineers inspect live data to debug these failures, protect sensitive fields first. Data masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in results. This lets your team check collection stats and run find queries safely. Good role design and clean driver settings keep your database free of command errors.
Inspect MongoDB wire traffic in flight
Built-in MongoDB roles govern collection access at setup time. They cannot score command risk per call or mask sensitive document values on the fly. By design, hoop.dev sits inline in the MongoDB protocol next to your server as a sidecar for your MongoDB. On every production command from mongosh, drivers, or AI agents, hoop.dev decides whether to pass, mask, block, or hold it for human review.
First, hoop.dev guardrails block bad deletes, drops, and write pipelines or hold them for approval. Next, hoop.dev data masking rewrites sensitive values in returned documents in memory and logs each decision. Explore the repo on GitHub.
Frequently asked questions
What does MongoDB error code 115 mean?
Error 115 is named CommandNotSupported in MongoDB. It means the server received a command that is not valid for its current version, storage engine, or node type.
Will granting admin roles fix CommandNotSupported?
No, granting wider roles will not fix code 115. The error means the server does not support the command itself, so you must change the command or target node.
How do I find which command triggered error 115?
Check your app exception log or the database server log for the failed request. The log entry shows the exact command name that the client tried to run.
Related guides
In this post