M
167
Call a Pro
MongoDB · Database Server & Atlas
MongoDB server reported: Stale Db Version.
Quick Answer
Error code 167 on your MongoDB Database Server & Atlas means: MongoDB server reported: Stale Db Version.. This is usually fixable — see the step-by-step guide below.
Affected Models
Likely Causes
  1. MongoDB returned code 167 (StaleDbVersion) while processing this request path.
  2. Cluster topology changed during execution (primary step-down, shard movement, or stale metadata).
  3. Replication or sharding state was not aligned with the operation preconditions.
How to Fix It
1
Review logs/telemetry for code 167 (StaleDbVersion) and capture the exact command and parameters that triggered it.
2
Gate retries on a stable cluster view and avoid stale routing caches.
3
Refresh topology metadata and retarget the command using current primary/shard ownership.
4
Review replication/sharding events around the timestamp to confirm role transitions.
5
Add monitoring for recurring StaleDbVersion events so future incidents are detected and triaged faster.
Pro Tip
This issue typically requires professional diagnosis. Attempting this fix without proper training could cause further problems.
Related Error Codes
Video Guides
Loading video guides…
Search more on YouTube →