334 — MechanismUnavailable

sharding

The database routing metadata is stale

What is happening?

StaleDbVersion is returned when a shard receives a command with a database version that does not match its current knowledge. This occurs after movePrimary operations, database creation on a different shard, or when the config server metadata changes. The driver or mongos normally retries transparently after refreshing the routing table.

Common causes

  1. movePrimary was recently executed for the database
  2. Database was dropped and recreated while operations were in-flight
  3. Config server metadata updated but the shard's cache is stale
  4. Multiple mongos instances with different cached database versions

Diagnostic Steps