Optional
causeOptional
codeThis is a number in MongoServerError and a string in MongoDriverError
Optional
connectionOptional
stackOptional
topologyStatic
Optional
prepareOptional override for formatting stack traces
Static
stackLegacy name for server error responses
Static
captureGenerated using TypeDoc
An error generated when a parsable unexpected response comes from the server. This is generally an error where the driver in a state expecting a certain behavior to occur in the next message from MongoDB but it receives something else. This error does not represent an issue with wire message formatting.
Example
When an operation fails, it is the driver's job to retry it. It must perform serverSelection again to make sure that it attempts the operation against a server in a good state. If server selection returns a server that does not support retryable operations, this error is used. This scenario is unlikely as retryable support would also have been determined on the first attempt but it is possible the state change could report a selectable server that does not support retries.