MongoServerError
Node.jsMongoErrorserver
An error response received from the MongoDB server (as opposed to a driver-side error)
What is happening?
MongoServerError represents an error returned by the MongoDB server in response to a command. It contains a numeric error code (e.g. 11000 for DuplicateKey) and an error message. This is the driver's wrapper around server-side errors — check the code property to identify the specific error.
Common causes
- DuplicateKey (11000) — unique index violation
- Unauthorized (13) — insufficient privileges
- CommandNotFound (59) — unsupported command for the server version
- ExceededTimeLimit (262) — maxTimeMS exceeded
- WriteConflict (112) — concurrent write conflict in WiredTiger